Easy C++ Solution || O(n) Time Complexity
\nclass Solution {\npublic:\n    vector<int> threeEqualParts(vector<int>& arr) \n    {\n        int n = arr.size();\n        vector<int> res(2);\n        res[0]
```\nclass Solution {\npublic:\n    vector<int> threeEqualParts(vector<int>& arr) \n    {\n        int n = arr.size();\n        vector<int> res(2);\n        res[0] = -1;\n        res[1] = -1;\n        \n        int totalCountOne = 0;\n        for(auto X: arr)\n        {\n            totalCountOne += X;\n        }\n        if(totalCountOne == 0)\n        {\n            res[0] = 0;\n            res[1] = 2;\n            return res;\n        }   \n        if((totalCountOne)%3 != 0)\n        {\n            return res;\n        }\n        \n        int noOfOneInEachPart = totalCountOne/3;\n        int idxOfFirstOneInPart0 = -1;\n        int idxOfFirstOneInPart1 = -1;\n        int idxOfFirstOneInPart2 = -1;\n        int NoOfOnes = 0;\n        for(int i=0; i<n; i++)\n        {\n            if(arr[i] == 1)\n            {\n                NoOfOnes++;\n                if(NoOfOnes == 1)\n                {\n                    idxOfFirstOneInPart0 = i;\n                }\n                else if(NoOfOnes == noOfOneInEachPart + 1)\n                {\n                    idxOfFirstOneInPart1 = i;\n                }\n                else if(NoOfOnes == 2*noOfOneInEachPart + 1)\n                {\n                    idxOfFirstOneInPart2 = i;\n                }\n            }\n        }\n        while(idxOfFirstOneInPart2<n)\n        {\n            if(arr[idxOfFirstOneInPart2] == arr[idxOfFirstOneInPart1] && arr[idxOfFirstOneInPart2] == arr[idxOfFirstOneInPart0])\n            {\n                idxOfFirstOneInPart0++;\n                idxOfFirstOneInPart2++;\n                idxOfFirstOneInPart1++;\n            }\n            else\n            {\n                return res;\n            }\n            \n        }\n        res[0] = idxOfFirstOneInPart0-1;\n        res[1] = idxOfFirstOneInPart1;\n        return res;\n    }\n};\n```
[]