'' Find two adjacent indices  to take difference
if ( index == 0 ) : NEW_LINE INDENT res = min ( res , abs ( num - right [ index ] ) ) NEW_LINE DEDENT elif ( index == len ( right ) ) : NEW_LINE INDENT res = min ( res , min ( abs ( num - right [ index - 1 ] ) , abs ( num - right [ index ] ) ) ) NEW_LINE DEDENT