Function that returns true if it is possible to transport all the boxes in the given amount of time
< ? php function isPossible ( $ box , $ truck , $ n , $ m , $ min_time ) { $ temp = 0 ; $ count = 0 ; while ( $ count < $ m ) { for ( $ j = 0 ; $ j < $ min_time && $ temp < $ n && $ truck [ $ count ] >= $ box [ $ temp ] ; $ j += 2 ) $ temp ++ ; $ count ++ ; }