For the last element the adjacents will be a [ 0 ] and a [ n - 2 ]
elif ( i == ( n - 1 ) ) : NEW_LINE INDENT if ( b [ n - 2 ] + b [ 0 ] <= b [ i ] ) : NEW_LINE INDENT print ( " - 1" ) NEW_LINE return NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT if ( b [ i - 1 ] + b [ i + 1 ] <= b [ i ] ) : NEW_LINE INDENT print ( " - 1" ) NEW_LINE return NEW_LINE DEDENT DEDENT