Find if k bookings possible with given arrival and departure times | Python Code Implementation of the above approach ; Driver Code
def areBookingsPossible ( A , B , K ) : NEW_LINE INDENT A . sort ( ) NEW_LINE B . sort ( ) NEW_LINE for i in range ( len ( A ) ) : NEW_LINE INDENT if i + K < len ( A ) and A [ i + K ] < B [ i ] : NEW_LINE INDENT return " No " NEW_LINE DEDENT DEDENT return " Yes " NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT arrival = [ 1 , 2 , 3 ] NEW_LINE departure = [ 2 , 3 , 4 ] NEW_LINE K = 1 NEW_LINE print areBookingsPossible ( arrival , departure , K ) NEW_LINE DEDENT