SHARE
TWEET

Untitled

a guest May 25th, 2019 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Solution {
  2.     public int longestOnes(int[] A, int K) {
  3.         int i = 0, j;
  4.         for (j = 0; j<A.length; j++) {
  5.             if (A[j] == 0) K--;
  6.             if (K < 0 && A[i++] == 0) K++;
  7.         }
  8.         return j - i;
  9.     }
  10. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top