Run error on the last test case
Updated the while loop to stop when its runs more than size. It still gives a run error.
But, it was an issue with the size of the run, then wouldn’t it be giving a TLE instead of run error?
add one more condition
max>=0 .
Oh got it. I was thinking looping till size would have worked.