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
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 ...
分类:
其他好文 时间:
2014-12-31 06:21:14
阅读次数:
281
问题描述:
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:
Y...
分类:
其他好文 时间:
2014-12-30 22:08:07
阅读次数:
178
Maximum Product Subarray
Total Accepted: 16617
Total Submissions: 96901
Find the contiguous subarray within an array (containing at least one number) which has the largest product.
For exampl...
分类:
其他好文 时间:
2014-12-30 10:09:57
阅读次数:
151