1206. Corporate Flight Bookings
My accepted Python solution to LeetCode problem 1206, Corporate Flight Bookings, running in 18ms.
- Difficulty: Medium
- Python
- Runtime 18ms
- Memory 29.1MB
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
Python
Accepted on LeetCode — runtime 18ms, memory 29.1MB, accepted 2026-01-02.
class Solution:
def corpFlightBookings(self, bookings: List[List[int]], n: int) -> List[int]:
# Difference array approach
diff = [0] * (n + 2)
for first, last, seats in bookings:
diff[first] += seats
diff[last + 1] -= seats
result = []
curr = 0
for i in range(1, n + 1):
curr += diff[i]
result.append(curr)
return result