Code RoomMaximum LED panel output
MediumPrep Room Coding #4898

Maximum LED panel output

CodingAlgorithms & data structuresMid–Senior~20 min

A stage lighting rig has one row of LED panels. Panel i cannot be driven past heat_caps[i], its heat limit, and every panel sits on a whole number of units from 0 upward. Two panels standing next to each other must not differ by more than max_step units or the seam between them looks harsh. Return the largest total the whole row can add up to. heat_caps may be empty, in which case the total is 0, and max_step may be 0. A panel with a low limit does not only hold down the panels to its right.

Implement
max_panel_brightness(heat_caps: list[int], max_step: int) → int
Examples
in[[10,10,1,10,10],1]out11
in[[4,4,4],0]out12
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.

0:00 of about 20 min
InputExpectedGot
[[10,10,1,10,10],1]11not run yetsample
[[4,4,4],0]12not run yetsample