Loop to iterate over the intervals with their start time
for ( int i = 0 ; i < n ; i ++ ) { if ( interval [ i ] [ 0 ] >= firstEndTime ) { firstEndTime = interval [ i ] [ 1 ] ; interval [ i ] . push_back ( ' S ' ) ; } else if ( interval [ i ] [ 0 ] >= secondEndTime ) { secondEndTime = interval [ i ] [ 1 ] ; interval [ i ] . push_back ( ' F ' ) ; } else { flag = true ; break ; } }