Question
A heart-rate monitor emits one reading per second, and the values arrive sorted for a post-workout report. Consecutive seconds often repeat the same value, and the report only needs each distinct rate once. Given the sorted list rates, return the distinct values in the same order using a read pointer and a write pointer in one pass — no set or extra map. Example: [60, 60, 62, 65, 65, 65, 70] becomes [60, 62, 65, 70].
unique_sorted_rates(rates: list[int]) → list[int][[60,60,62,65,65,65,70]]out[60,62,65,70]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.