Calculate left and right pointer index .
left = min ( left , where [ i ] ) ; right = max ( right , where [ i ] ) ; int diff = right - left ; if ( diff == 0 diff == 1 ) { continue ; } int val1 = v [ left ] ; int val2 = v [ right ] ; int minn = min ( val1 , val2 ) ;