question: https://online.codingblocks.com/player/25648/content/10179/4829
answer: https://ide.codingblocks.com/s/130838
wrong naswer for second case
Pigeon hole principle
hey @dhruvika, that’s because you are not resetting the value of psum array in each iteration, just add:
for(int i=0;i<n;i++) psum[i]=0;
at line no. 16