2016年6月29日

Maximum Subarray

摘要: Find 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, 阅读全文

posted @ 2016-06-29 20:35 Sheryl Wang 阅读(246) 评论(0) 推荐(0) 编辑

Minimum Adjustment Cost

摘要: Given an integer array, adjust each integers so that the difference of every adjacent integers are not greater than a given number target. If the arra 阅读全文

posted @ 2016-06-29 17:56 Sheryl Wang 阅读(106) 评论(0) 推荐(0) 编辑

4Sum

摘要: Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array whic 阅读全文

posted @ 2016-06-29 16:29 Sheryl Wang 阅读(178) 评论(0) 推荐(0) 编辑

3Sum Closest

摘要: Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. 阅读全文

posted @ 2016-06-29 16:17 Sheryl Wang 阅读(151) 评论(0) 推荐(0) 编辑

3Sum

摘要: Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of 阅读全文

posted @ 2016-06-29 16:10 Sheryl Wang 阅读(219) 评论(0) 推荐(0) 编辑

N-Queens

摘要: The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. Given an integer n, return all 阅读全文

posted @ 2016-06-29 15:45 Sheryl Wang 阅读(222) 评论(0) 推荐(0) 编辑

Backpack

摘要: Given n items with size Ai, an integer m denotes the size of a backpack. How full you can fill this backpack? If we have 4 items with size [2, 3, 5, 7 阅读全文

posted @ 2016-06-29 11:51 Sheryl Wang 阅读(223) 评论(0) 推荐(0) 编辑

K Sum

摘要: Given n distinct positive integers, integer k (k <= n) and a number target. Find k numbers where sum is target. Calculate how many solutions there are 阅读全文

posted @ 2016-06-29 11:37 Sheryl Wang 阅读(369) 评论(0) 推荐(0) 编辑

导航