Maximum Consecutive Ones III (If K Flip is Allowed)

Sdílet
Vložit
  • čas přidán 7. 09. 2024
  • Given an array which only consists of 0s and 1s. Write a code to find the maximum number of consecutive 1s in an array, if we can flip k zeros.
    Maximum consecutive ones III java code - webrewrite.com...
    Maximum consecutive ones II - • Maximum Consecutive On...
    Maximum consecutive ones in an array of 0s and 1s - • Maximum Consecutive On...
    For example:
    Input: {1, 1, 0, 0, 0, 1, 1, 1, 1, 1}, k = 2
    Output: 7

Komentáře • 37