摘要: 题目:[https://leetcode cn.com/problems/invert binary tree/description/] 思路:题目要求交换二叉树的左右叶子,直接遍历全树,交换左右节点即可 代码 讨论区[https://leetcode.com/problems/invert bi 阅读全文
posted @ 2018-09-27 18:17 Kipper 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 题目:[https://leetcode cn.com/problems/minimum depth of binary tree/description/] 思路:逐层遍历,当某层有子节点时,当前层即是最小深度 代码: 讨论区[https://leetcode.com/problems/minim 阅读全文
posted @ 2018-09-20 17:52 Kipper 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 题目:[https://leetcode cn.com/problems/positions of large groups/description/] 思路:题目要求统计出现3次以上字母分组,返回其首尾值的集合。通过观察,不断比较前后字母是否相等并计数,返回出现3次以上的序列值 代码 讨论区[ht 阅读全文
posted @ 2018-09-19 14:19 Kipper 阅读(270) 评论(0) 推荐(0) 编辑
摘要: 题目:[https://leetcode cn.com/problems/image smoother/description/] 思路:一道直接模拟题目,计算图片的灰度,注意边界控制。 代码: 讨论区[https://leetcode.com/problems/image smoother/dis 阅读全文
posted @ 2018-09-19 02:14 Kipper 阅读(409) 评论(0) 推荐(0) 编辑