heap
文章平均质量分 76
Yingying_code
这个作者很懒,什么都没留下…
展开
-
378. Kth Smallest Element in a Sorted Matrix**
Given a n x n matrix where each of the rows and columns are sorted in ascending order, find the kth smallest element in the matrix. Note that it is the kth smallest element in the sorted order, not t原创 2017-01-12 00:03:47 · 282 阅读 · 0 评论 -
347. Top K Frequent Elements**
iven 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 assume k is always valid, 1 ≤ k ≤ number o原创 2017-01-12 23:47:05 · 298 阅读 · 0 评论 -
373. Find K Pairs with Smallest Sums**
You are given two integer arrays nums1 and nums2 sorted in ascending order and an integer k. Define a pair (u,v) which consists of one element from the first array and one element from the seco原创 2017-01-13 00:01:46 · 212 阅读 · 0 评论 -
23. Merge k Sorted Lists***
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. My code: public class Solution { public ListNode mergeKLists(ListNode[] lists) { Prio原创 2017-02-10 21:56:37 · 257 阅读 · 0 评论 -
313. Super Ugly Number**
Write a program to find the nth super ugly number. Super ugly numbers are positive numbers whose all prime factors are in the given prime list primes of size k. For example, [1, 2, 4, 7, 8, 13,转载 2017-02-10 23:05:50 · 351 阅读 · 0 评论 -
332. Reconstruct Itinerary**
Given a list of airline tickets represented by pairs of departure and arrival airports [from, to], reconstruct the itinerary in order. All of the tickets belong to a man who departs from JFK. Thus,原创 2017-01-25 23:36:43 · 366 阅读 · 0 评论 -
295. Find Median from Data Stream***
Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two middle value. Examples: [2,3,4] , the median原创 2017-02-26 18:36:12 · 283 阅读 · 0 评论