LeetCode 83. Remove Duplicates from Sorted List(java)

You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1...

2018-02-26 02:16:37

阅读数:23

评论数:0

LeetCode 142. Linked List Cycle II(java)

Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Note: Do not modify the linked list.Follow up: Can yo...

2018-01-25 12:08:31

阅读数:22

评论数:0

LeetCode 23. Merge k Sorted Lists(java)

Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.解法一:用heap来做,先把k个list的第一个元素放进heap,每次poll出一个后,放进poll出...

2018-01-20 08:43:25

阅读数:126

评论数:0

LeetCode 148. Sort List(java)

Sort a linked list in O(n log n) time using constant space complexity.思路:由于linkedlist是一个不回头的只向下走的数据结构,因此,我们在考虑多种排序方式时,会发现快排需要双指针找pivot,因此不合适,而merge s...

2018-01-16 12:48:08

阅读数:18

评论数:0

LeetCode 141. Linked List Cycle(java)

Given a linked list, determine if it has a cycle in it.Follow up: Can you solve it without using extra space?解法:快慢指针相遇。/** * Definition for singly-...

2018-01-16 11:32:10

阅读数:10

评论数:0

LeetCode 287. Find the Duplicate Number(java)

Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist....

2018-01-15 08:15:47

阅读数:23

评论数:0

LeetCode 2. Add Two Numbers

You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes conta...

2018-01-11 11:28:44

阅读数:80

评论数:0

提示
确定要删除当前文章?
取消 删除
关闭
关闭