摘要: class Solution { public: vector<vector<string>> res; vector<string> path; bool is(string s, int start, int end) { for (int i = start, j = end; i < j; 阅读全文
posted @ 2022-09-04 15:00 hjy94wo 阅读(17) 评论(0) 推荐(0)
摘要: class Solution { public: vector<vector<int>> res; vector<int> path; int sum = 0; void dfs(int start, int k, int n) { if (path.size() > k || sum > n) r 阅读全文
posted @ 2022-09-04 14:34 hjy94wo 阅读(14) 评论(0) 推荐(0)
摘要: class Solution { public: vector<vector<int>> res; vector<int> path; int sum; void dfs(int start, vector<int>& candidates, int target) { if (sum > targ 阅读全文
posted @ 2022-09-04 09:18 hjy94wo 阅读(28) 评论(0) 推荐(0)
摘要: class Solution { public: vector<vector<int>> res; vector<int> path; int sum = 0; void dfs(int start, vector<int>& candidates, int target) { if (sum > 阅读全文
posted @ 2022-09-04 08:51 hjy94wo 阅读(16) 评论(0) 推荐(0)
摘要: dfs 定义string数组初始化后加; char型 - ‘0’转为int型 class Solution { public: vector<string> res; string path; const string map[10] = { "", "", "abc", "def", "ghi", 阅读全文
posted @ 2022-09-02 16:37 hjy94wo 阅读(23) 评论(0) 推荐(0)
摘要: dfs class Solution { public: vector<int> path; vector<vector<int>> res; void dfs(int start, int n, int k) { if (path.size() == k) { res.push_back(path 阅读全文
posted @ 2022-09-02 16:11 hjy94wo 阅读(17) 评论(0) 推荐(0)
摘要: DFS AcWing 842. 排列数字 #include <iostream> using namespace std; const int N = 10; int n; int path[N], st[N]; void dfs(int u) { if (u == n) { for (int i 阅读全文
posted @ 2022-09-02 15:33 hjy94wo 阅读(70) 评论(0) 推荐(0)
摘要: const int N = 20; class Solution { public: vector<vector<string>> res; bool col[N], dg[N], udg[N]; void dfs(int u, int n, vector<string>& path) { if ( 阅读全文
posted @ 2022-09-02 15:29 hjy94wo 阅读(16) 评论(0) 推荐(0)
摘要: 思路: 当字符串为运算符号是弹出栈中两个数字进行运算 stoi("1") 将string转换为int class Solution { public: int evalRPN(vector<string>& tokens) { stack<int> stack; for (int i = 0; i 阅读全文
posted @ 2022-08-27 09:59 hjy94wo 阅读(21) 评论(0) 推荐(0)
摘要: class Solution { public: string removeDuplicates(string s) { stack<char> stack; for (int i = 0; i < s.size(); i ++) { if (stack.empty() || s[i] != sta 阅读全文
posted @ 2022-08-27 09:18 hjy94wo 阅读(19) 评论(0) 推荐(0)