Javascript code implementation of the above approach
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 " " ; }