Three Equal Parts | Java solution
```\n public int[] threeEqualParts(int[] arr) {\n        int n = arr.length ;\n        List ones=new ArrayList() ;\n        for(int i = 0 ; i < n ; i++)\n      
```\n public int[] threeEqualParts(int[] arr) {\n        int n = arr.length ;\n        List<Integer> ones=new ArrayList() ;\n        for(int i = 0 ; i < n ; i++)\n        {\n            if(arr[i]>0)\n            {\n                ones.add(i) ;\n            }\n        }\n        int cnt = ones.size() ;\n        if(cnt == 0)\n        {\n            return new int[]{0 , n - 1} ;\n        }\n        if(cnt%3!=0)         \n        {\n            return new int[]{-1 , -1} ;\n        }\n        int f = ones.get(0);\n        int s = ones.get(cnt/3);\n        int t = ones.get((cnt/3)*2) ;\n        while(t < n && arr[f] == arr[s] && arr[f] == arr[t])\n        {\n            f++ ;\n            s++ ;\n            t++ ;\n        }\n        if(t == n)\n        {\n            return new int[]{f - 1 , s} ;\n        }\n        return new int[]{-1 , -1} ;\n    }
[]