← back to unit
Medium
# breaking it down medium
The Longest Quiet Stretch
The classroom noise meter logs every minute. The teacher wants to brag: how long did the quiet last? 🤫
You get the noise levels and the quiet limit. Print the length of the longest run of consecutive minutes strictly below the limit.
Example:
Input: levels = [3, 1, 2, 8, 1, 1, 1, 9], limit = 4
Output: 3
The streak of minutes below 4 builds up as 1, 2, 3 (indices 0-2), resets at the loud 8, then builds again to 1, 2, 3 (indices 4-6), resetting at 9 — the longest streak reached is 3.
💡 need a hint?
brk-longest-quiet.py🔒 given lines are locked — write your code in between
loading...