无码av一区二区三区无码,在线观看老湿视频福利,日韩经典三级片,成 人色 网 站 欧美大片在线观看

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

LeetCode 1109. Corporate Flight Bookings

2023-05-30 11:30 作者:您是打尖兒還是住店呢  | 我要投稿

There are?n?flights that are labeled from?1?to?n.

You are given an array of flight bookings?bookings, where?bookings[i] = [firsti, lasti, seatsi]?represents a booking for flights?firsti?through?lasti?(inclusive) with?seatsi?seats reserved for?each flight?in the range.

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

?

Example 1:

Input: bookings = [[1,2,10],[2,3,20],[2,5,25]], n = 5

Output: [10,55,45,25,25]

Explanation:

Flight labels:? ? ? ? ? ? ? 1 ? 2 ? 3 ? 4 ? 5?

Booking 1 reserved: ?10 ?10?

Booking 2 reserved: ? ? ?20 ?20?

Booking 3 reserved: ? ? ?25 ?25 ?25 ?25?

Total seats: ? ? ? ? 10 ?55 ?45 ?25 ?25 Hence, answer = [10,55,45,25,25]

Example 2:

Input: bookings = [[1,2,10],[2,2,15]], n = 2

Output: [10,25]

Explanation:

Flight labels:? ? ? ? ? ? ? ?1 ? 2?

Booking 1 reserved: ?10 ?10

Booking 2 reserved:? ? ? ??15?

Total seats: ? ? ? ? 10 ?25 Hence, answer = [10,25]

?依次遍歷即可,

下面是代碼:

Constraints:

  • 1 <= n <= 2 * 104

  • 1 <= bookings.length <= 2 * 104

  • bookings[i].length == 3

  • 1 <= firsti?<= lasti?<= n

  • 1 <= seatsi?<= 104


Runtime:?803 ms, faster than?33.42%?of?Java?online submissions for?Corporate Flight Bookings.

Memory Usage:?55.2 MB, less than?98.74%?of?Java?online submissions for?Corporate Flight Bookings.


LeetCode 1109. Corporate Flight Bookings的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國家法律
法库县| 阿尔山市| 三门峡市| 屏东市| 庆城县| 嘉祥县| 洪泽县| 巴林右旗| 南郑县| 喀喇沁旗| 尼勒克县| 阜南县| 龙海市| 正定县| 云霄县| 英山县| 平南县| 垫江县| 赤水市| 保山市| 长寿区| 长汀县| 蒙城县| 阿城市| 讷河市| 广东省| 龙江县| 宜城市| 华亭县| 喜德县| 两当县| 安康市| 芷江| 龙胜| 炉霍县| 资中县| 郴州市| 林州市| 广丰县| 平潭县| 常宁市|