This is the question from recently CodeJunk Contest, It gives me WA , I try my best but I can’t Figure out how to correct my code.

My approach->>

**Basically Using Binary search from low =1 to high=m , where m is the maximum value element in the array**

**comparing the f(mid) with my global ans, and simultaneously also check for mid-1 and mid+1 half{similar that we do ne Binary search with some required modification}**

PS:->> I have done 2 hours on this but doesn’t reach to the solution, Please help me if you can.

Thanks in Advance.