My code is running but giving a wrong output


the output should be 122 but it is giving 50 as the output
please tell me what’s wrong in my code

Your Approach is not correct
have to applied this approach on given sample input?

arrays are sorted ,use this feature
Correct approach is using 2Pointer Technique
Reference Code