← Back
00:00

Best Ski Route

Airbnb interview questions · Hard · Coding round · 6 tests

You are skiing downhill from a node named START. Each checkpoint may award points, and each route between checkpoints has a travel-time cost. Your final score is:

sum(points of visited checkpoints) - sum(travel times along the route)

Any node with no outgoing routes is considered a valid finish.

Interface

findBestSkiRoute(
  travelTime: Array<[from: string, to: string, cost: number]>,
  points: Record<string, number>,
): { score: number; path: string[] }

Rules

Idle