The TransCompilator

Solved LeetCode program · 837 of 1,000

#1109 · Corporate Flight Bookings

Medium Array chunk-17.md

Original English source

The bookings is a list of 1, 2, 10, 2, 3, 20, 2, 5, and 25. The flights is 5. The changes is a list of 7 zeros.
For every booking from 0 to 2.
The base is booking times 3. The first is item base of bookings. The last is item (base plus 1) of bookings. The seats is item (base plus 2) of bookings. Increase item (first minus 1) of changes by seats. Decrease item last of changes by seats.

The running is 0.
For every flight from 0 to flights minus 1.
The change is item flight of changes. Add change to running. Show running.

Open in Playground Browse all 1,000 problems

Expected stdout

10
55
45
25
25