Spring Hire Sale
Limited Time Deal: Unlock all premium questions for over 30% off
$10.42$7.08
08
:
04
:
45
:
28
Back to Dashboard
Best Ski Route
Hard
Question
You are skiing down from the top of a mountain and want to maximize your score when you reach the finish.
There are multiple routes you can take, and each route has checkpoints with different point values associated with them. Your final score will be determined by the sum of all the checkpoints you hit minus the total travel time.
Find the optimal route to maximize your final score.
Part 1 — Single Starting Point
Given travel_time (edges between checkpoints with travel times) and points (point values at each checkpoint), find the path from START to any FINISH that maximizes: sum(points) - sum(travel_time).
Example 1
Input:
START(0)
/ \
6 8
/ \
A[18] B[26]
| \ / |
...