Longest Uptime With K Repairs
A health check recorded status[i] = 1 when a service was up during minute i and 0 when it was down. In hindsight you may *repair* at most k down minutes, turning them into up minutes.
Return the length of the longest run of consecutive up minutes you can achieve.
Example 1
Input: status = [1, 1, 0, 0, 1, 1, 1, 0, 1], k = 2 Output: 7 Explanation: Repair minutes 2 and 3 to get seven up minutes from index 0 to 6.
Example 2
Input: status = [0, 0, 0], k = 0 Output: 0
Constraints
- 0 <= status.length <= 10^5
- status[i] is 0 or 1
- 0 <= k <= status.length
Hint 1
Look for the longest window that contains at most k zeros.
Hint 2
Expand right; when there are too many zeros, move the left edge forward.
Good practice for: DevOps Engineer, Site Reliability Engineer, Cloud Engineer, Backend Developer, MLOps Engineer, Embedded Systems Engineer
Run checks your code on 2 sample tests. Submit runs all 8 tests, including hidden ones, and earns points. Use console.log to debug. Python's first run can take a few seconds while it starts.