Minimum toll checkpoint cost
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]) → intExamples
in
[[1,100,1,1,100,1]]out4in
[[10,1,10,1,10]]out22What 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.
0:00 of about 10 min
solution.py
InputExpectedGot
[[1,100,1,1,100,1]]4not run yetsample[[10,1,10,1,10]]22not run yetsample