public int findSplit(int[] arr) {
        int right0 = 0, right1 = 0;
        for (int i : arr) {
            if (i == 0) right0++;
            else right1++;
        }
        int left0 = 0, left1 = 0, max = 0;
        for (int i : arr) {
            if (i == 0) right0--;
            else right1--;
            max = Math.max(max, left0 + right1);
            if (i == 0)
                left0++;
            else left1++;
        }
        return max;
    }