![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
树
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 评论 -
2019年冬季 7-4 Cartesian Tree (30分)
A Cartesian tree is a binary tree constructed from a sequence of distinct numbers. The tree is heap-ordered, and an inorder traversal returns the original sequence. For example, given the sequence { 8, 15, 3, 4, 1, 5, 12, 10, 18, 6 }, the min-heap Cartesia原创 2020-11-29 09:51:14 · 156 阅读 · 0 评论