We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0eb964f commit 95113f4Copy full SHA for 95113f4
solution/1109.Corporate Flight Bookings/Solution.java
@@ -0,0 +1,16 @@
1
+class Solution {
2
+ public int[] corpFlightBookings(int[][] bookings, int n) {
3
+ int[] res = new int[n];
4
+ for (int[] booking : bookings) {
5
+ int b = booking[0] - 1, e = booking[1], k = booking[2];
6
+ res[b] += k;
7
+ if (e < n) {
8
+ res[e] -= k;
9
+ }
10
11
+ for (int i = 1; i < n; ++i) {
12
+ res[i] += res[i - 1];
13
14
+ return res;
15
16
+}
0 commit comments