![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
DFS
DFS
WatchLessMobile
这个作者很懒,什么都没留下…
展开
-
leetcode 301. 删除无效的括号
建立决策树的BFS、DFS题。有两种解法。我的两种解法优化的都不是很好,不论是时间还是空间都没有进50%BFS解法要用set来解决掉重复元素。用unordered_set要比set快很多https://leetcode-cn.com/problems/remove-invalid-parentheses/class Solution {public: vector<string> res; void BFS(string s) { queue原创 2020-12-22 10:47:16 · 133 阅读 · 0 评论 -
1135 Is It A Red-Black Tree (30分)
https://pintia.cn/problem-sets/994805342720868352/problems/994805346063728640本质上是DFS题注意红黑树是二叉搜索树#include <iostream>#include <algorithm>using namespace std;const int SIZE = 10005;struct Node { int data; int redOrBlack; //re.原创 2020-11-23 20:08:54 · 73 阅读 · 0 评论