题目描述:
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.
...
分类:
其他好文 时间:
2015-01-05 11:13:23
阅读次数:
174
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 at most two transactions.
Note:
You may ...
分类:
其他好文 时间:
2015-01-04 17:14:20
阅读次数:
130
Find the contiguous subarray within an array (containing at least one number) which has the largest product.
For example, given the array [2,3,-2,4],
the contiguous subarray [2,3] has the largest ...
分类:
其他好文 时间:
2015-01-04 17:13:57
阅读次数:
158
Given an unsorted array, find the maximum difference between the successive elements in its sorted form.Try to solve it in linear time/space.Return 0 ...
分类:
其他好文 时间:
2015-01-04 06:25:08
阅读次数:
192
eclipse 默认设置的换行长度, 格式化代码后,经常换行,非常难看。 1.Java代码打开Eclipse的Window菜单,然后Preferences->Java->Code Style->Formatter->Edit ->Line Wrapping->Maximum line width:默...
分类:
编程语言 时间:
2015-01-04 01:10:41
阅读次数:
292
Binary Tree Maximum Path SumGiven a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the be...
分类:
其他好文 时间:
2015-01-03 11:52:22
阅读次数:
137
Longest Palindromic Substring
Question
Solution
Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists...
分类:
其他好文 时间:
2015-01-03 00:57:31
阅读次数:
272
Given n items with size A[i] and value V[i], and a backpack with size m. What's the maximum value can you put into the backpack?NoteYou cannot divide ...
分类:
其他好文 时间:
2015-01-01 01:24:21
阅读次数:
168
用分桶的做法,思路参考自网友,很精妙。class Solution {public: int maximumGap(vector &num) { int size = num.size(); if (size minBucket(bucketSize, INT_M...
分类:
其他好文 时间:
2015-01-01 00:07:06
阅读次数:
237
DP.类似最大和。就是要记录正的和负的两种情况。class Solution {public: int maxProduct(int A[], int n) { vector positive(n); vector minus(n); int resu...
分类:
其他好文 时间:
2015-01-01 00:06:23
阅读次数:
214