标签:ati pre tin ble ems size href 试题 span
链接:https://leetcode-cn.com/problems/zi-fu-chuan-de-pai-lie-lcof/
class Solution { public: vector<string> permutation(string s) { vector<string> res; sort(s.begin(), s.end()); dfs(s, 0, s.size(), res); return res; } void dfs(string s, int l, int r, vector<string>& res) { if (l == r) res.push_back(s); else { for (int i = l; i < r; ++i) { if (i > l && s[i] == s[l]) continue; swap(s[i], s[l]); dfs(s, l + 1, r, res); } } } };
标签:ati pre tin ble ems size href 试题 span
原文地址:https://www.cnblogs.com/clown9804/p/12398241.html