You are viewing a single comment's thread. Return to all comments →
Here is my easy C++ solution, explanation here : https://youtu.be/e32U19k1X6A
void separateNumbers(string s) { int bl = 1; bool f = false; while(bl * 2 <= s.size()){ string base = s.substr(0, bl); string newString = ""; long baselong = atol(base.c_str()); do{ newString += to_string(baselong); baselong++; }while(newString.size() < s.size()); if(newString == s) {cout << "YES " << base;f = true;break;} bl++; } if(!f) cout << "NO"; cout << endl; }
Seems like cookies are disabled on this browser, please enable them to open this website
Separate the Numbers
You are viewing a single comment's thread. Return to all comments →
Here is my easy C++ solution, explanation here : https://youtu.be/e32U19k1X6A