Maximize Circular Rover Travel
Problem statement
A circular route has length circumference. Each stops[i] = [position,fuel] has a distinct position. Choose any stop as the start and collect its fuel. Traveling one distance unit consumes one fuel.
Moving clockwise, collect each reached stop at most once. If fuel cannot reach the next uncollected stop, travel until fuel is exhausted. After collecting every stop, continue until remaining fuel is exhausted without collecting stops again. Return the maximum total distance traveled.
Function
maximumRoverDistance(circumference: int, stops: int[][]) → longExamples
Example 1
circumference = 100stops = [[0,10],[10,30],[60,40]]return = 80Start at 60, wrap to 0, then reach 10 and use the remaining fuel to stop at position 40 after 80 total distance.
Constraints
1 <= stops.length <= 2000.0 <= position < circumference.- Fuel amounts are nonnegative.