
Greedy
文章平均质量分 81
zshouyi
这个作者很懒,什么都没留下…
展开
-
122. Best Time to Buy and Sell Stock II
Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy on原创 2017-01-27 08:31:49 · 225 阅读 · 0 评论 -
402. Remove K Digits
Given a non-negative integer num represented as a string, remove k digits from the number so that the new number is the smallest possible.Note:The length of num is less than 10002 and will b原创 2017-05-20 05:00:59 · 214 阅读 · 0 评论 -
392. Is Subsequence
Given a string s and a string t, check if s is subsequence of t.You may assume that there is only lower case English letters in both s and t. t is potentially a very long (length ~= 500,000) strin原创 2017-05-07 13:58:39 · 251 阅读 · 0 评论 -
484. Find Permutation
By now, you are given a secret signature consisting of character 'D' and 'I'. 'D' represents a decreasing relationship between two numbers, 'I' represents an increasing relationship between two number原创 2017-05-25 09:49:19 · 427 阅读 · 0 评论 -
435. Non-overlapping Intervals
Given a collection of intervals, find the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping.Note:You may assume the interval's end point is alw原创 2017-05-25 07:08:37 · 330 阅读 · 0 评论 -
452. Minimum Number of Arrows to Burst Balloons
There are a number of spherical balloons spread in two-dimensional space. For each balloon, provided input is the start and end coordinates of the horizontal diameter. Since it's horizontal, y-coordin原创 2017-05-25 05:50:50 · 264 阅读 · 0 评论 -
406. Queue Reconstruction by Height
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 person and k is the number of people in front of t原创 2017-05-24 14:50:30 · 263 阅读 · 0 评论 -
134. Gas Station
There are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station i to原创 2017-05-24 10:25:50 · 209 阅读 · 0 评论 -
376. Wiggle Subsequence
A sequence of numbers is called a wiggle sequence if the differences between successive numbers strictly alternate between positive and negative. The first difference (if one exists) may be either pos原创 2017-05-12 00:35:24 · 223 阅读 · 0 评论 -
55. Jump Game
Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position. Determine原创 2017-02-23 08:31:46 · 225 阅读 · 0 评论 -
455. Assign Cookies
Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a greed factor gi, which is the minimum size of a c原创 2017-01-27 08:47:27 · 196 阅读 · 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 评论