You are viewing a single comment's thread. Return to all comments →
long beautifulStrings(string S) { unordered_set<string> beautifulStrings; for (int i = 0; i < S.length(); i++) { for (int j = i + 1; j < S.length(); j++) { string candidate = S.substr(0, i) + S.substr(i + 1, j - i - 1) + S.substr(j + 1); beautifulStrings.insert(candidate); } } return beautifulStrings.size(); }
Note : Only 3 test case passed.
Seems like cookies are disabled on this browser, please enable them to open this website
Beautiful Strings
You are viewing a single comment's thread. Return to all comments →
C++ Solution :