Startup Interview Coding Question: Maximum Score Path in a Ski Tournament

21 Views
No Comments

You’re in a ski tournament, where you ski from the top of the mountain to one of the finish checkpoints at the bottom. There are multiple routes with checkpoints, and each checkpoint has an associated point value.

Your total score = points from all checkpoints you visited – time of your travel.

Given:

  • A list of lists, each containing [start_cp, end_cp, time_to_travel]
  • A list of lists, each containing [cp, point]

Goal:

Find the maximum score that you can collect during the tournament and print out the optimal path.

This problem is a maximum-score path search on a weighted directed graph: each checkpoint contributes points, while each route adds travel time cost, so the objective is to maximize total checkpoint points minus total travel time and return the optimal path. A typical solution uses graph modeling plus dynamic programming over a DAG or topological order to propagate the best achievable score to each checkpoint, while storing predecessors to reconstruct the path. The main challenge is combining node rewards with edge costs correctly and selecting the best reachable finish checkpoint.

END
 0