Find least non | function to find the smallest non - overlapping number ; Sort the intervals based on their starting value ; Check if any missing value exist ; Finally print the missing value ; Driver code
def find_missing ( interval ) : NEW_LINE INDENT interval . sort ( ) NEW_LINE mx = 0 NEW_LINE for i in range ( len ( interval ) ) : NEW_LINE INDENT if ( interval [ i ] [ 0 ] > mx ) : NEW_LINE INDENT print ( mx ) NEW_LINE return NEW_LINE DEDENT else : NEW_LINE INDENT mx = max ( mx , interval [ i ] [ 1 ] + 1 ) NEW_LINE DEDENT DEDENT print ( mx ) NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT interval = [ [ 0 , 14 ] , [ 86 , 108 ] , [ 22 , 30 ] , [ 5 , 17 ] ] NEW_LINE find_missing ( interval ) ; NEW_LINE DEDENT