- 博客(5)
- 收藏
- 关注
原创 [LeetCode]candy分糖果
题目描述There are N children standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following requirements:Each child must have at least ...
2019-02-22 09:26:15 589
原创 [LeetCode]linked-list-cycle ii 环形链表
问题描述Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up: Can you solve it without using extra space?解题思路首先,需要判断链表中有无环,借助快慢指针去寻找,fast每次走两步,sl...
2019-02-15 12:21:57 179
原创 [leetcode]reorder-list
题目描述:Given a singly linked list L: L 0→L 1→…→L n-1→L n,reorder it to: L 0→L n →L 1→L n-1→L 2→L n-2→…You must do this in-place without altering the nodes' values.For example,Given{1,2,3,4}, reo...
2019-02-12 12:06:10 374
原创 [leetcode]binary-tree-preorder-Traversal
题目描述:Given a binary tree, return the preorder traversal of its nodes' values.Note: Recursive solution is trivial, could you do it iteratively?实现思路:要实现非递归的二叉树前序遍历,可以借助栈来实现,前序遍历是根-左-右,先把根压栈然后弹出到...
2019-02-11 12:41:19 165
原创 [leetcode]binary-tree-postorder-Traversal
题目描述:Given a binary tree, return the postorder traversal of its nodes' values.Note: Recursive solution is trivial, could you do it iteratively?实现思路:要实现非递归的二叉树后序遍历,这里学习到了一个巧妙的解法,借助栈来实现,将前序遍历加以修...
2019-02-01 12:23:30 188
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人