Tap here to switch tabs
Problem
Submissions

Problem: Corporate Flight Bookings

med
30 min
Try to solve the Corporate Flight Bookings problem.

Statement

There are n flights labeled from 11 to n.

You are given an array of flight bookings bookings, where bookings[i] = [first_i, last_i, seats_i] represents a booking for all flights from first_i to last_i inclusive, with seats_i seats reserved for each flight.

Return an array answer of length n, where answer[i] is the total number of seats reserved for flight i+1i + 1.

Constraints:

  • 1≤1 \leq n ≤2imes104\leq 2 imes 10^4

  • 1≤1 \leq bookings.length ≤2imes104\leq 2 imes 10^4

  • bookings[i].length =3= 3

  • 1≤1 \leq first_i ≤\leq last_i ≤\leq n

  • 1≤1 \leq seats_i ≤104\leq 10^4

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Corporate Flight Bookings

med
30 min
Try to solve the Corporate Flight Bookings problem.

Statement

There are n flights labeled from 11 to n.

You are given an array of flight bookings bookings, where bookings[i] = [first_i, last_i, seats_i] represents a booking for all flights from first_i to last_i inclusive, with seats_i seats reserved for each flight.

Return an array answer of length n, where answer[i] is the total number of seats reserved for flight i+1i + 1.

Constraints:

  • 1≤1 \leq n ≤2imes104\leq 2 imes 10^4

  • 1≤1 \leq bookings.length ≤2imes104\leq 2 imes 10^4

  • bookings[i].length =3= 3

  • 1≤1 \leq first_i ≤\leq last_i ≤\leq n

  • 1≤1 \leq seats_i ≤104\leq 10^4