Maximum LED panel output
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) → intExamples
in
[[10,10,1,10,10],1]out11in
[[4,4,4],0]out12What 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
solution.py
InputExpectedGot
[[10,10,1,10,10],1]11not run yetsample[[4,4,4],0]12not run yetsample