![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C/C++解Leetcode
Golden age
这个作者很懒,什么都没留下…
展开
-
面试题 04.03. 特定深度节点链表(层次遍历)
class Solution { public: vector<ListNode*> listOfDepth(TreeNode* tree) { queue<TreeNode*> q; q.push(tree); vector<ListNode*> ret; while(!q.empty()){ int size = q.size(); ListNod.原创 2021-02-03 20:57:21 · 89 阅读 · 0 评论 -
面试题 01.09. 字符串轮转
class Solution { public: bool isFlipedString(string s1, string s2) { return s1.size()==s2.size()&&(s1+s1).find(s2)!=-1; } };原创 2021-02-01 23:00:38 · 70 阅读 · 1 评论 -
面试题 08.10. 颜色填充
void dfs(int** image, int rowSize, int colSize, int r, int c, int newColor, int oldColor){ if (r<0 || c<0 || r>=rowSize || c>=colSize || image[r][c] == newColor || image[r][c] != oldColor ){ return; } image[r][c] = newColor;原创 2021-01-31 22:40:38 · 153 阅读 · 0 评论 -
剑指offer55-Ⅱ. 平衡二叉树
leetcode刷题剑指offer55-Ⅱ. 平衡二叉树 剑指offer55-Ⅱ. 平衡二叉树 #define max(a,b) (a>b?a:b) int depth(struct TreeNode* root){ if(!root) return 0; int left = depth(root->left); if(left==-1) return -1; int right = depth(root->right); if(right==原创 2021-01-30 21:50:44 · 57 阅读 · 0 评论