Not able to find the problem
Hey @siddharth9k9 make the size of your sum array to 100000+1 and start your for loop from i=1 in line 21.
If you have any further doubts please feel free to ask,otherwise kindly mark the doubt as resolved.
how you get to about these errors.
The max element considered should have been 10^5 , so you needed to declare the frequency array of size+1 as its 0 indexed. And you mere missing the cases where numbers could have been ‘1’ ,so that’s why we had to start the loop from i=1;
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.