class Solution {
public int[] corpFlightBookings(int[][] bookings, int n) {
int[] diff = new int[n];
for (int[] booking : bookings) {
int first = booking[0], last = booking[1], seats = booking[2];
diff[first-1] += seats;
if (last < n) {
diff[last] -= seats;
}
}
int[] passengers = new int[n];
passengers[0] = diff[0];
for (int i = 1; i < n; i++) {
passengers[i] = passengers[i-1] + diff[i];
}
return passengers;
}
}