
贪心算法
子长
这个作者很懒,什么都没留下…
展开
-
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 this p原创 2017-10-20 00:37:22 · 225 阅读 · 0 评论 -
455.assign cookies
ssume 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 cooki原创 2017-10-29 23:12:50 · 198 阅读 · 0 评论 -
53. Maximum Subarray (9月12日)
53. Maximum SubarrayFind the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [-2,1,-3,4,-1,2,1,-5,4], the contiguous subarra原创 2017-09-11 21:10:14 · 207 阅读 · 0 评论 -
算法期中1000. 分组
Description 对于一个整数数列A[0], A[1], …, A[N-1]进行分组,要求每组1到2个数,并且同组之和不能大于w. 求最少可以分成多少组.1 <= N <= 100000, 1 <= A[i] <= w <= 1000000000.请实现下面Solution类中计算minPartition(A, w)的函数.class Solution { public: i原创 2017-11-12 23:13:38 · 495 阅读 · 0 评论 -
11. Container With Most Water
哦?markdown编辑器更新了?啥玩意? 不管不管,完成作业要紧。 题目 leetcode 11 Given n non-negative integers a1, a2, …, an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two e原创 2018-01-07 22:23:40 · 155 阅读 · 0 评论