
LeetCode
heqianqiann
每一个不曾起舞的日子都是对生命的辜负
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
LeetCode Invert Binary Tree 翻转二叉树
题目描述:Invert a binary tree.样例输入输出: 1 1 / \ / \2 3 => 3 2 / \ 4 4解法一: 递归实现private void invertRecursion(TreeNode root) { if (root == null) { return;原创 2017-09-13 10:24:02 · 458 阅读 · 0 评论 -
LeetCode Identical Binary Tree 相同二叉树
题目描述:Check if two binary trees are identical. Identical means the two binary trees have the same structure and every identical position has the same value.样例输入: 1 1 / \ / \原创 2017-09-13 10:03:14 · 445 阅读 · 0 评论 -
LeetCode Flatten Binary Tree to Linked List 将二叉树展开成链表
题目描述:Flatten a binary tree to a fake “linked list” in pre-order traversal. Here we use the right pointer in TreeNode as the next pointer in ListNode.样例输入: 1 / \ 2 5 / \ \ 3 4 6样例原创 2017-09-13 09:33:05 · 1439 阅读 · 0 评论 -
LeetCode BackPack 背包问题
//从上个月末之后就开始有点浮躁起来,本来计划国庆查漏补缺v.22bd 的,结果网卡光荣的坏了ORZ……无论如何,OFFER现在还没有拿到,即便是拿到了也不该放松学习的状态。Stay Hungry,Stay Foolish背包问题是动态规划的经典问题,LeetCode上有五种背包的变种问题,现在总结一下。背包问题一(最大放入重量)题目描述:Given n items with size Ai,原创 2017-10-03 22:36:03 · 12878 阅读 · 4 评论