Code Room
CodingEasycod-g1475
Subject Dynamic programming 1dLevel Entry–Mid~10 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

A toll road on your trip has checkpoints in order, with a fee listed for each. You start standing on the first checkpoint (and pay its fee), and you must finish standing on the last one. From any checkpoint you may drive ahead to the next checkpoint or skip one and land two ahead; you pay the fee of every checkpoint you land on. Given the fees, return the minimum total you must pay. The list has at least one checkpoint.

Implement
min_toll_cost(fees: list[int]) → int
Examples
in[[1,100,1,1,100,1]]out4
in[[10,1,10,1,10]]out22
What a strong answer looks like

State 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.

Run or narrate your approach, then ask the coach.