LeetCode 205. Isomorphic Strings(java)

Given two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the characters in s can be replaced to get t.All occurrence...

2018-02-03 14:12:03

阅读数:16

评论数:0

LeetCode 406. Queue Reconstruction by Height(java)

Suppose you have a random list of people standing in a queue. Each person is described by a pair of integers (h, k), where h is the height of the per...

2018-01-26 08:29:30

阅读数:25

评论数:0

LeetCode 347. Top K Frequent Elements(java)

Given a non-empty array of integers, return the k most frequent elements.For example, Given [1,1,1,2,2,3] and k = 2, return [1,2].Note: You may as...

2018-01-25 07:09:30

阅读数:24

评论数: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

阅读数:132

评论数: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

阅读数:20

评论数:0

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