Easy java solution
\nclass Solution {\n    public int[] threeEqualParts(int[] A) {\n        List<Integer> plist = new ArrayList<>();\n        for (int i = 0; i < A.length; i++) {\
```\nclass Solution {\n    public int[] threeEqualParts(int[] A) {\n        List<Integer> plist = new ArrayList<>();\n        for (int i = 0; i < A.length; i++) {\n            if (A[i] == 1) {\n                plist.add(i);\n            }\n        }\n        // all zero\n        if (plist.size() == 0) {\n            return new int[]{0, 2};\n        }\n        // #1 is not 3x\n        if (plist.size() % 3 != 0) {\n            return new int[]{-1, -1};\n        }\n        // check gaps between 1s\n        int count = plist.size()/3;\n        int s1 = 0;\n        int s2 = count;\n        int s3 = 2*count;\n        for (int i = 0; i < count-1; i++) {\n            int gap1 = plist.get(s1+i+1) - plist.get(s1+i);\n            int gap2 = plist.get(s2+i+1) - plist.get(s2+i);\n            int gap3 = plist.get(s3+i+1) - plist.get(s3+i);\n            if (gap1 != gap2 || gap2 != gap3) {\n                return new int[]{-1, -1};\n            }\n        }\n        // check right 0-padding for least significant bits\n        int rpad1 = plist.get(s2) - plist.get(s2-1) - 1;\n        int rpad2 = plist.get(s3) - plist.get(s3-1) - 1;\n        int rpad3 = A.length - plist.get(plist.size()-1) - 1;\n        if (rpad1 < rpad3 || rpad2 < rpad3) {\n            return new int[]{-1, -1};\n        }\n        \n        return new int[]{\n            plist.get(s2-1)+rpad3, \n            plist.get(s3-1)+rpad3+1\n        };\n    }\n}\n```
[]