Code Room
CodingMediumcod-g1485
Subject Dynamic programming 1dLevel Entry–Mid~14 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

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]) → int
Examples
in[[8,3,2,9]]out17
in[[10,1,1,1,10]]out20
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.