how to apply constraint on N in the code?
Constraint application
@deepaksehrawat150_50930f2fcb83f47e you can see that the no of elements in each row increase and forms an arithmetic progression with common diffrence equal to 1
so to get the elements present in n lines we need to find
1+2+3…+n
which is equal to (n*(n+1))/2
by this you get the total no of elements present
if your dout is clear mark it resolved and if not clear feel free to ask
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.
I still can’t understand , there are many problems in which constraint equation are given , and i don’t know how to apply those, please explain in detail .
@deepaksehrawat150_50930f2fcb83f47e you need to observe things how they form a pattern for example you can clearly see that in the above question the no of elements increases by 1 for each row for some different question it will be some another observation and you just need to find that and then apply some math formula on that it will be done