Pretty short Java solution(~15 lines), explained
The idea is to count the number of ones numOnes: \n\nIf numOnes isn\'t divisible by 3, then you can\'t divide them into 3 parts so return [-1, -1]. \n\nSecondly
The idea is to count the number of ones `numOnes`: \n\nIf `numOnes` isn\'t divisible by 3, then you can\'t divide them into 3 parts so return [-1, -1]. \n\nSecondly, if there are only zeroes in the array, you can divide the array arbitrarily.\n\nFinally, if `numOnes` is divisible by 3, we run three pointers `first, second and third` and check whether the division is possible.\n\n`first` points to the First One of the array, `second` points to the `numOnes/3`th One of the array, and `third` points to the `2*numOnes/3`th One of the array.\nAdvance the three pointer, if there is a mismatch at any step, return [-1, -1].\nIf the `third` pointer finally manages to reach the end, we have a valid division, because everything matched!\n\nWhat I said in code:\n```java\nclass Solution {\n    public int[] threeEqualParts(int[] arr) {\n        int numOnes = 0;\n        List<Integer> pos = new ArrayList<>();\n        for(int i = 0; i < arr.length; i++){\n            numOnes += arr[i];\n            if(arr[i] == 1) pos.add(i);\n        }\n        if(numOnes % 3 != 0) return new int[]{-1, -1};\n        if(numOnes == 0) return new int[]{0, arr.length-1};\n        int first = pos.get(0), second = pos.get(numOnes/3), third = pos.get(numOnes/3 *2);\n        while(first < second && second < third && third < arr.length){\n            if(arr[first] != arr[second] || arr[second] != arr[third]) return new int[]{-1, -1};\n            first++; second++; third++;\n        }\n        return third == arr.length ? new int[]{first-1, second} : new int[]{-1, -1};\n    }\n}\n```\nOkay, not 15 lines, it\'s 18. You can probably sue me for that ;)\nBut I hope you understand how the solution works.
['Java']