Question
A sensor logs the water level of a storage tank once per hour, in centimeters. Levels often repeat across readings. Given the list of readings and an integer k, return the k-th lowest distinct level — duplicates collapse to a single entry before counting. You may assume k is at least 1 and no larger than the number of distinct levels. Example: levels = [40, 10, 10, 25], k = 2 gives 25, because the distinct levels in increasing order are 10, 25, 40.
kth_lowest_level(levels: list[int], k: int) → int[[40,10,10,25],2]out25State 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.