Find if k bookings possible with given arrival and departure times | Javascript code implementation of the above approach ; Driver code
function areBookingsPossible ( A , B , K , N ) { A . sort ( ) ; B . sort ( ) ; for ( let i = 0 ; i < N ; i ++ ) { if ( i + K < N && A [ i + K ] < B [ i ] ) { return " " ; } } return " " ; } let arrival = [ 1 , 2 , 3 ] ; let departure = [ 2 , 3 , 4 ] ; let N = arrival . length ; let K = 1 ; document . write ( areBookingsPossible ( arrival , departure , K , N ) ) ;