Find if k bookings possible with given arrival and departure times | C # code implementation of the above approach ; Driver Code
using System ; class GFG { static string areBookingsPossible ( int [ ] A , int [ ] B , int K ) { Array . Sort ( A ) ; Array . Sort ( B ) ; for ( int i = 0 ; i < A . Length ; i ++ ) { if ( i + K < A . Length && A [ i + K ] < B [ i ] ) { return " No " ; } } return " Yes " ; } static void Main ( ) { int [ ] arrival = { 1 , 2 , 3 } ; int [ ] departure = { 2 , 3 , 4 } ; int K = 1 ; Console . Write ( areBookingsPossible ( arrival , departure , K ) ) ; } }