"""
Exercise 2: Max Consecutive Ones III (LeetCode 1004)

nums has only 0s and 1s; you may flip at most k zeros. Return the length of
the longest run of 1s you can get. The window is valid while it contains at
most k zeros.

  longest_ones([1,1,1,0,0,0,1,1,1,1,0], 2) -> 6
"""

def longest_ones(nums, k):
    # TODO
    return 0


# --- self-check: do not modify below this line ---
cases = [([1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0], 2, 6), ([0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1], 3, 10), ([0, 0, 0], 0, 0), ([1, 1], 0, 2)]
ok = True
for nums, k, want in cases:
    got = longest_ones(nums, k)
    print(nums, k, "->", got)
    ok = ok and got == want
print("PASS" if ok else "FAIL")
