Max Consecutive Ones III

Given a binary array nums and an integer k, return the maximum number of consecutive 1s obtainable by flipping at most k zeros inside one contiguous subarray.

Given a binary array `nums` and an integer `k`, return the maximum number of consecutive `1`s obtainable by flipping at most `k` zeros inside one contiguous subarray.

- `1 <= nums.length <= 10^5` - `nums[i]` is either `0` or `1` - `0 <= k <= nums.length` - The interactive visualizer accepts at most 12 values; longer valid arrays are execution-only.

Example 1: input nums = [1,1,1,0,0,0,1,1,1,1,0], k = 2; output 6. Flip two zeros in the range [0,0,1,1,1,1] to obtain six consecutive ones.

Example 2: input nums = [1,0,1,1,0], k = 0; output 2. With no flips, the longest existing run contains two ones.

Category: Sliding Window. Topic: sliding-window. Difficulty: Medium. Patterns: sliding-window, two-pointers.