Weekly Contest
暴力解,就這樣。
程式碼:
class Solution { public: vector<string> stringSequence(string target) { vector<string> results; string temp; for (int i = 0; i < target.size(); i++) { for (int j = int('a'); j <= target[i]; j++) { temp.push_back(char(j)); results.push_back(temp); temp.pop_back(); } temp.push_back(target[i]); } return results; } };
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up