Question
A hopscotch course for a game level is a row of stones, each with a height. Your character starts on the first stone and must reach the last one, hopping either to the next stone or over one stone to the stone after it. A hop from stone i to stone j costs the absolute height difference between them. Given the heights (at least one stone), return the minimum total cost to reach the last stone. For example, [10, 30, 40, 20] costs 30.
min_hop_cost(heights: list[int]) → int[[10,30,40,20]]out30[[30,10,60,10,60,50]]out40State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.