Easy C++ solution using strings in O(n) time and space complexity
Intuition\nThree Simple observations :-\n1.Total number of ones should be multiple of 3.\n2.Leading zeroes do not contribute\n3.Number of zeroes after the last 
# Intuition\nThree Simple observations :-\n1.Total number of ones should be multiple of 3.\n2.Leading zeroes do not contribute\n3.Number of zeroes after the last one of all 3 parts will be equal to the number of zeroes after the last one in 3rd part.\n\n# Approach\n1.Store the indexes of ones in a vector and check if the size is multiple of 3.\n2.Check if the zeroes after the last 1s of first and second part are greater than or equal to zeroes after the last one in 3rd part.\n3.Form strings for all 3 parts ignoring leading zeroes and check if they are equal.\n\n# Code\n```\nclass Solution {\npublic:\n    vector<int> threeEqualParts(vector<int>& v) {\n        vector<int> one;\n        int n=v.size();\n        for(int i=0;i<n;i++){\n            if(v[i]==1) one.push_back(i+1);\n        }\n        if(one.size()==0){\n            return {0,2};\n        }\n        if(one.size()%3)    return {-1,-1};\n\n        int ext=n-one.back(),sz=one.size();\n        int gap1=one[sz/3]-one[sz/3-1]-1,gap2=one[2*sz/3]-one[2*sz/3-1]-1;\n        // cout<<gap1<<" "<<gap2<<endl;\n        if(gap1<ext || gap2<ext)    return {-1,-1};\n\n        string s1,s2,s3;\n        for(int i=0;i<=one[sz/3-1]+ext-1;i++){\n            if(s1.length()>0 || v[i])   s1+=to_string(v[i]);\n        }\n\n        for(int i=one[sz/3-1]+ext;i<=one[2*sz/3-1]+ext-1;i++){\n            if(s2.length()>0 || v[i])   s2+=to_string(v[i]);\n        }\n\n        for(int i=one[2*sz/3-1]+ext;i<=n-1;i++){\n            if(s3.length()>0 || v[i])   s3+=to_string(v[i]);\n        }\n        //All 3 Numbers in vector v :-\n        // num1={0,one[sz/3-1]+ext-1};\n        // num2={one[sz/3-1]+ext,one[2*sz/3-1]+ext-1}\n        // num3={one[2*sz/3-1]+ext,n-1};\n        if(s1==s2 && s2==s3)    return {one[sz/3-1]+ext-1,one[2*sz/3-1]+ext};\n        return {-1,-1};\n    }\n};\n```
['String', 'C++']