✔️ Easy Java O(N) || 100% fast || 1 ms time || count hack approach :)
Added comments in java code to explain more deeply\n\n\n// 927. Three Equal Parts\n// Runtime: 1 ms, faster than 100.00% of Java online submissions for Three Eq
**Added comments in java code to explain more deeply**\n```\n\n// 927. Three Equal Parts\n// Runtime: 1 ms, faster than 100.00% of Java online submissions for Three Equal Parts.\n// Memory Usage: 44.9 MB, less than 60.58% of Java online submissions for Three Equal Parts.\n\nclass Solution {\n    public int[] threeEqualParts(int[] arr) {\n        int countOne=0,n=arr.length;\n        \n        //count number of zeroes\n        for(int i:arr)\n            countOne+=i;\n        \n        //if all 0 return return (0, length)\n        if(countOne==0)\n            return new int[]{0,n-1};\n        //if not divisible by 3 then return (-1,-1)\n        if(countOne%3!=0)\n            return new int[]{-1,-1};  \n        \n        \n        \n        int start = 0,mid = 0,end = 0;\n        int averageOneCount=countOne/3;\n        countOne=0;\n        \n        \n        for(int i=0;i<n;i++){\n            //skip all zeroes\n            if(arr[i]==0)\n                continue;\n             \n            //mark 1st 1 as start\n            if(countOne==0)\n                start=i;\n            \n            countOne++;   \n            //find mid \'1\' element\n           if(countOne == averageOneCount + 1) \n                mid = i;\n            \n            //find last \'1\' element\n           if(countOne == 2 * averageOneCount + 1) \n                end = i;\n            \n        }\n        \n        //skip all elements which are same\n        while(end < n && arr[start] == arr[mid] && arr[mid] == arr[end]){\n            start++;\n            mid++;\n            end++;\n        }\n        \n        //if we reach end then its possible so return (start-1,end)\n        if(end == n) {\n            return new int[]{start-1,mid};\n        }\n        \n        //else return as its not possible\n        return new int[]{-1,-1}; \n        \n    }\n}\n\n```
['Counting', 'Java']