bool carPooling(int** arr, int len, int* tripsColSize, int capacity){ long long cnt[1004]; int i, j; memset(cnt, 0, sizeof(cnt)); for(i=0; i<len; i++){ for(j=arr[i][1]; j<arr[i][2]; j++){ cnt[j] += arr[i][0]; } } for(i=0; i<1004; i++){ if(cnt[i] > capacity) return false; } return true; }