07 2018 档案
leetcode 142. Linked List Cycle II
摘要:题目要求不修改链表结构,同时不用额外的内存,去找到链表中环的起点。 我们可以通过快慢指针很容易判断有没有环,接下来,再把快指针的步伐也变为1并从head开始走,那么快慢指针再次相遇对应的指针就是环的起点。 解释:可以把问题抽象成一个直线和圈的结构, 粉色点表示相遇点,那么快指针走过a+b+c+b,慢 阅读全文
posted @ 2018-07-16 19:43 Beserious 阅读(124) 评论(0) 推荐(0) 编辑
leetcode 152. Maximum Product Subarray
摘要:Given an integer array nums, find the contiguous subarray within an array (containing at least one number) which has the largest product. 题意:求最大的连乘。 思 阅读全文
posted @ 2018-07-11 21:06 Beserious 阅读(129) 评论(0) 推荐(0) 编辑
leetcode 860. Lemonade Change
摘要:At a lemonade stand, each lemonade costs $5. Customers are standing in a queue to buy from you, and order one at a time (in the order specified by bil 阅读全文
posted @ 2018-07-01 14:49 Beserious 阅读(253) 评论(0) 推荐(0) 编辑
leetcode 863. All Nodes Distance K in Binary Tree
摘要:We are given a binary tree (with root node root), a target node, and an integer value . Return a list of the values of all nodes that have a distance 阅读全文
posted @ 2018-07-01 11:44 Beserious 阅读(670) 评论(0) 推荐(0) 编辑