Test case 3 isnt working

one of my test cases is not working for this code:

Modified Code

l and r should be index not the value
you have taken l=a[0] and r=a[n-1]
but it should be l=0 and r=n-1;