- 博客(19)
- 资源 (1)
- 收藏
- 关注
原创 第八章课后作业
Chapter 8 NP-complete problems8.10descriptionProving NP-completeness by generalization. For each of the problems below, prove that it is NP-complete by showing that it is a generalization of some ....
2017-06-24 19:45:26
380
转载 最大和
最大和description从数列A[0], A[1], A[2], …, A[N-1]中选若干个数,要求相邻的数不能都选,也就是说如果选了A[i], 就不能选A[i-1]和A[i+1]. 求能选出的最大和.1 <= N <= 100000, 1 <= A[i] <= 1000请为下面的Solution类实现解决上述问题的函数maxSum,函数参数A是给出的数列,返回值为所求的最大和
2017-06-24 19:30:27
180
转载 Valid Perfect Square
Valid Perfect SquaredescriptionGiven a positive integer num, write a function which returns True if num is a perfect square else False.Note: Do not use any built-in library function such as sqrt()....
2017-06-11 16:02:12
166
转载 Guess Number Higher or Lower
Guess Number Higher or LowerdescriptionWe are playing the Guess Game. The game is as follows:I pick a number from 1 to n. You have to guess which number I picked.Every time you guess wrong....
2017-06-11 15:57:54
198
转载 Is Subsequence
Is SubsequencedescriptionGiven 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 ....
2017-06-11 15:52:00
187
转载 Arranging Coins
Arranging CoinsdescriptionYou have a total of n coins that you want to form in a staircase shape, where every k-th row must have exactly k coins.
2017-06-11 15:47:14
197
转载 Excel Sheet Column Number
Excel Sheet Column NumberdescriptionRelated to question Excel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.
2017-05-20 13:32:02
174
转载 Roman to Integer
Roman to Integerdescription Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999.
2017-05-20 13:20:06
104
转载 Remove K Digits
Remove K Digitsproblem: 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.
2017-04-24 20:59:32
258
转载 Decode String
Decode Stringproblem:Given an encoded string, return it’s decoded string.The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is being repeated exactly k times.
2017-04-24 20:43:20
318
转载 Next Greater Element I
Next Greater Element Iproblem:You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1’s elements in the .......
2017-04-24 20:34:02
230
转载 Kth Largest Element in an Array
description: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.
2017-04-08 15:29:06
153
转载 Search a 2D Matrix II
description:Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted in ascending from left to right.....
2017-04-08 15:17:11
178
原创 Different Ways to Add Parentheses
description:Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The valid operators are +, - and *.
2017-04-08 15:04:42
160
原创 Maximum Subarray
Maximum Subarraydescription: Find the contiguous subarray within an array (containing at least one number) which has the largest sum.
2017-03-19 19:45:00
182
原创 文章标题
Majority Elementdescription: Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.
2017-03-12 12:51:39
181
原创 #Roman to Integer
Roman to Integer:Given a roman numeral, convert it to an integer.
2017-03-05 19:25:43
137
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人