Why is not passing all the test cases?
Rain Water Harvesting
It is given in the question
Constraints
1 <= N <= 10^6
But you have restricted your array size to 10^3
Still requires 3 more test cases to be passed.
Check now.
If still test case does not pass then cross check your logic with this code https://ide.codingblocks.com/s/265965
Please tell what changes have you made in the code
I just increased the size of you arrays to 10^6 and made it global.
Interger array of size greater that 10^5 declared within main gives runtime error. If you make it global then the maximum allowed size increases to upto 10^7.
Here is a video. https://www.youtube.com/watch?v=Uog2Jmyb3iY …
You can watch this and check how sir has implemented it.
the code you have edited is giving errors.
Error was due to variable names.right and left as global variable was not being accepted.