Algorithm · ByteDance · Medium
Problem: Total Walking Distance with Boost Stations You begin at coordinate 0 on a one-dimensional path and need to transport goods to target. There are m boost stations located at p[i]. Rules: From the goods' current location cur, you can walk to any station p[i] for which p[i] >= cur. That traveled amount is included in the walking total. When multiple stations are available, choose the station that results in the minimum possible total walking distance. Once the goods…
Checking your access…