
Heap
文章平均质量分 82
zshouyi
这个作者很懒,什么都没留下…
展开
-
451. Sort Characters By Frequency
Given a string, sort it in decreasing order based on the frequency of characters.Example 1:Input:"tree"Output:"eert"Explanation:'e' appears twice while 'r' and 't' both appear once.So 'e原创 2017-03-10 08:54:39 · 214 阅读 · 0 评论 -
407. Trapping Rain Water II
Given an m x n matrix of positive integers representing the height of each unit cell in a 2D elevation map, compute the volume of water it is able to trap after raining.Note:Both m and n are l原创 2017-06-21 08:28:51 · 275 阅读 · 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 second原创 2017-05-22 15:57:53 · 289 阅读 · 0 评论 -
253. Meeting Rooms II
Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] (si < ei), find the minimum number of conference rooms required.For example,Given [[0, 30],[5,原创 2017-05-21 02:22:08 · 284 阅读 · 0 评论 -
215. Kth Largest Element in an Array
Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For example,Given [3,2,1,5,6,4] and k = 2, return 5.原创 2017-05-08 06:08:37 · 488 阅读 · 0 评论 -
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原创 2017-05-07 08:57:53 · 259 阅读 · 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-03-24 11:12:17 · 251 阅读 · 0 评论 -
264. Ugly Number II
Write a program to find the n-th ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 1, 2, 3, 4, 5, 6, 8, 9, 10, 12 is the sequence of the first原创 2017-03-22 08:07:33 · 267 阅读 · 0 评论 -
355. Design Twitter
Design a simplified version of Twitter where users can post tweets, follow/unfollow another user and is able to see the 10 most recent tweets in the user's news feed. Your design should support the fo原创 2017-03-11 10:07:27 · 281 阅读 · 0 评论 -
239. Sliding Window Maximum
Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window原创 2017-06-23 14:05:15 · 317 阅读 · 0 评论