Billboard revenue
A highway agency sells billboard slots along a road, listed in order with the expected revenue for each (all positive). Local rules say two rented billboards must have at least two empty slots between them — so if you take slot i, the next one you take must be at index i+3 or later. Given the revenues, return the maximum total you can earn. An empty list returns 0. For example, [8, 3, 2, 9] gives 17 by taking slots 0 and 3.
Implement
max_billboard_revenue(revenues: list[int]) → intExamples
in
[[8,3,2,9]]out17in
[[10,1,1,1,10]]out20What 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 14 min
solution.py
InputExpectedGot
[[8,3,2,9]]17not run yetsample[[10,1,1,1,10]]20not run yetsample