注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
今天才做的,SWE full time,OA. 两题都是地里的。
求米看经!
1. Shrinking Number Line, 也叫 Smallest Range 2
里寇就已领,这里有图和提示-
最近频繁出现: 2022-09-12,2022-09-01, 2022-08-28, 2022-08-27, 2022-08-23
2. Visiting Cities
最近出现: 2022-09-12,2022-09-03, 2022-08-27
There are a number of cities in a row, and there are two bus lines that go between them. They both visit all the cities in order, but one may take longer than the other to go between any two cities. Starting on or moving to the Blue line takes a certain amount of extra time. There i2, 5]
-To get to city 3:
-Take the Red line, arriving at 5 + 4 = 9
-Stay on the Blue line, arriving at 5 + 1 = 6
-The blueCost does not apply if you stay on the Blue line or move to the Red line
-The final ans array is [0, 2, 5, 6] |