what is wrong with this code: https://ide.codingblocks.com/s/201928
Rain water Harvesting
Hi @Codemaniac_Aditya
use
for(int i=1;i<n-1;i++)
ans+=min(left[i],right[i])-arr[i];
as u cannot store water on top of arr[0] and arr[n-1].
Hope dis helps
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.