same issue with me , take upper bound to 2*109 and try again.
It is 1e10
I think your fun program is wrong , bcz binary search seems correct .
“https://www.codechef.com/viewsolution/37318274” check my solution and figure out where u did wrong .
Your valid function worked
Got my mistake. I forgot to write
else if(in+val>arr[i] && in+val<=arr[i]+d) in=in+val;
I have tried many times with different higher bounds,but couldnt find where its going wrong
please someone help me out with this code(THE CODE IS IN JAVA)