Just logic( Super Easy)
1) Calculate number of 1\'s , let store it in cnt\n\n2) if cnt is not divisible by 3 return [-1,-1]\n\n\t3) now check in array from right to left and stop when 
1) Calculate number of 1\'s , let store it in cnt\n\n2) if cnt is not divisible by 3 return [-1,-1]\n\n\t3) now check in array from right to left and stop when got cnt/3 ones. the part beyond it must be the number we need. It it is not then    no other solution exists.Eg : arr = 01001000100 , so cnt = 3 ,and we got part after first one from right = "100"\n\t\n\t4) Now check it to exist in start as well. skip all trailing zeros and then see if "100" is in start as well. Yes, we it.\n\t\n\t5) Now final step, after that 100 in start, again 100 should exist after start as well. Again skip all trailing zeros after the first "100" and look for another "100", if found, still maybe the it is answer, mayber it is not, therefore check if all the array elements after this middle "100" we got to the "100" that is at the end are all Zeros, only then we get three "100" else return [-1,-1]\n\n 6) Now return { ans = end of first "100" , end of second "100"}\n\n\nCODE :-\n\nvector<int> threeEqualParts(vector<int>& arr) {\n     int n =  arr.size();\n        int l=0,ll=0;\n        int cnt = 0;\n        for(int  i = 0 ; i < n  ; i ++ )\n        {\n            if(arr[i] == 1) cnt++;\n        }\n        if(cnt == 0) return {0,n-1};\n        if(cnt%3 != 0 ) return {-1,-1};\n        \n        int jj = 0;\n        \n        int third = n-1;\n\n        //while(arr[third] == 0) third--;\n     for(int  i =  n-1 ; i >= 0 ; i--)\n     {\n         if(arr[i] == 1)\n         {\n             jj++;\n             if(jj==cnt/3)\n             {\n                third = i;\n                 break;\n             }\n         }\n     }\n                cout<<third<<endl;\n        \n        int b = 0 , e = third;\n        while(arr[b] == 0) b++;\n        \n        while(e < n)\n        {\n            cout<<b<<" ---- "<<e<<endl;\n            if(arr[b] != arr[e]) \n            {\n                cout<<b<<" "<<e<<endl;\n                return {-1,-1};\n            }\n            b++;\n            e++;\n        }\n        cout<<b<<" "<<e<<endl;\n        int first = 0, sec = b;\n        l=b-1;\n        \n        while(arr[sec] == 0 ) sec++;\n        while(arr[first] == 0) first++;\n        \n        while(first < b && sec < third)\n        {\n            if(arr[first] != arr[sec])\n            {\n                cout<<"bye";\n                return {-1,-1};\n            }\n            first++;\n            sec++;\n        }\n        if(sec>=third && first<b) return {-1,-1};\n        ll = sec;\n        cout<<sec<<" "<<third<<endl;\n        while(sec < third)\n        {\n            if(arr[sec] != 0)\n            {\n                cout<< "yoyoy";\n                return {-1,-1};\n            }\n            sec++;\n        }\n        \n        \n        \n        \n        return {l,ll};\n    }\n\n
[]