[C++] O(n^2) time O(1) space, 96ms, with explanation
For this problem, we can regarde the string as the type, 000(some zeros)***(a binary number starts with \'1\' and has length k)000(some zeros)***(same binary nu
For this problem, we can regarde the string as the type, `000(some zeros)***(a binary number starts with \'1\' and has length k)000(some zeros)***(same binary number)0000(some zeros)***(same binary number)`.\n\nSo what we need to do is try to find the first no-zero bit and iterate the value of k from `1` to `(l-start)/3`.\n```\nclass Solution {\npublic:\n    vector<int> threeEqualParts(vector<int>& A) {\n        vector<int> ans={-1,-1};\n        int sum=0;\n        for(int item:A) sum+=item;\n        if(sum==0){\n            ans={0,A.size()-1};\n            return ans;\n        }\n        int start=0,l=A.size();\n        while(A[start]==0) start++;\n        for(int k=1;k<=(l-start)/3;++k){\n            int start2=k+start;\n            while(start2<l && A[start2]==0) start2++;\n            if(start2>=l) continue;\n            int start3=k+start2;\n            while(start3<l && A[start3]==0) start3++;\n            if((start3+k)==l){\n                if(Compare(A,start,start2,start3,k)){\n                    ans={start+k-1,start2+k};\n                    return ans;\n                }\n            }\n        }\n        return ans;\n    }\n    bool Compare(vector<int>& A, int a, int c, int d, int k){\n        for(int iter=0;iter<k;++iter)\n            if(A[a+iter]!=A[c+iter] || A[d+iter]!=A[c+iter]) return false;\n        return true;\n    }\n};\n```
[]