Question
A smart energy meter posts one integer power reading at a time. After each reading arrives, the dashboard wants the median of all readings received so far. To keep everything in integers, report each median doubled: for an odd count report 2 times the middle value; for an even count report the sum of the two middle values. Return the list of doubled medians, one per reading, in arrival order. Example: readings = [5, 2, 8] gives [10, 7, 10].
running_median_doubled(readings: list[int]) → list[int][[5,2,8]]out[10,7,10]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.