- 博客(3)
- 收藏
- 关注
原创 力扣 2021 3月
226. 翻转二叉树(0301) 递归题,稀里糊涂的,不过抓准目标,每次递归的内容是什么;什么是结束条件。随时记着这两点,递归问题很好解决 class Solution { public: TreeNode* invertTree(TreeNode* root) { if(root == NULL) return NULL; else { //交换左右子树 TreeNode* temp = root-
2021-04-12 09:40:13 108
原创 力扣 2021 1-2月
66.加一(0129) hello again,手生了,今天开始捡起来吧。 这题…权当又碰到vector的insert吧,其他没什么,大数加法的基本操作,嗯。 class Solution { public: vector<int> plusOne(vector<int>& digits) { int iter = digits.size() - 1; int carry = 1, mid; for(int i = it
2021-03-01 09:44:19 129
原创 力扣2020
每天一道力扣 1. two-sum(0919):1 map和unordered_map的区别 map是红黑树,unordered_map是哈希表 这道题就适合用unordered_map 第一遍遍历的时候相减得到的差在map里面找一找 如何有效地返回一个vector? 就是先声明一个res,再返回res就行了 You should return by value. 20. 有效的括号(0920):2 关于栈,c++的栈怎么个用发 算法过程!hin重要 遍历输入字符串 如果当前字符为左半边括号时,则将其压入
2021-01-29 20:58:01 78
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人