随笔分类 -  贪心

摘要:Given an array, rotate the array to the right by k steps, where k is non-negative. Example 1: Input: [1,2,3,4,5,6,7] and k = 3 Output: [5,6,7,1,2,3,4] 阅读全文
posted @ 2020-03-29 19:59 米开朗菠萝 阅读(141) 评论(0) 推荐(0)
摘要:At a lemonade stand, each lemonade costs $5. Customers are standing in a queue to buy from you, and order one at a time (in the order specified by bil 阅读全文
posted @ 2020-03-29 17:49 米开朗菠萝 阅读(135) 评论(0) 推荐(0)
摘要:A string S of lowercase letters is given. We want to partition this string into as many parts as possible so that each letter appears in at most one p 阅读全文
posted @ 2020-03-29 17:20 米开朗菠萝 阅读(180) 评论(0) 推荐(0)
摘要: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 g 阅读全文
posted @ 2020-03-29 13:50 米开朗菠萝 阅读(136) 评论(0) 推荐(0)
摘要: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 hor 阅读全文
posted @ 2020-03-29 11:34 米开朗菠萝 阅读(99) 评论(0) 推荐(0)
摘要: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 l 阅读全文
posted @ 2020-03-29 10:09 米开朗菠萝 阅读(130) 评论(0) 推荐(0)
摘要: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 comple 阅读全文
posted @ 2020-03-25 19:59 米开朗菠萝 阅读(132) 评论(0) 推荐(0)