这里要用到桶排序,感觉不太感兴趣,就直接看了网上的做法。C++中vector中的一些常用函数:取容器中的最大最小值min_element(),max_element()。当有必要对一个接受pair参数的函数传递两个值时, make_pair()尤其显得方便。int minAll = *min_ele...
分类:
其他好文 时间:
2015-06-23 19:57:47
阅读次数:
124
Maximum Subarray: https://leetcode.com/problems/maximum-subarray/
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [...
分类:
其他好文 时间:
2015-06-23 13:40:52
阅读次数:
145
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,1,?5,4],
the contiguous subarray [4,?1,2,1] ha...
分类:
其他好文 时间:
2015-06-23 11:55:55
阅读次数:
176
最大子数组的和 在给定的一个数组中,找出连续的一部分数组,使其中的元素和最大。例如输入1,-2,5,3,-3,7,-2,-1,输出的最大子数组和为12。 ①如果什么都不考虑,用最直接的办法来求解,即三重for循环来暴力求结果,该算法的时间复杂度为O(n^3)代码如下://本段代码引自编程之美
int MaxSum(int* A, int n)
{
int maximum = -INF;...
分类:
编程语言 时间:
2015-06-21 15:49:47
阅读次数:
124
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 if the array contains less than 2 elements...
分类:
其他好文 时间:
2015-06-21 14:33:28
阅读次数:
214
原题链接:https://leetcode.com/problems/longest-palindromic-substring/
Given a string S,
find the longest palindromic substring inS.
You may assume that the maximum length of S is
1000, and ther...
分类:
其他好文 时间:
2015-06-21 14:33:22
阅读次数:
119
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 one unique longes...
分类:
其他好文 时间:
2015-06-20 22:00:33
阅读次数:
219
题目:
Longest Palindromic Substring
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 one unique longest...
分类:
其他好文 时间:
2015-06-20 17:07:53
阅读次数:
126
Description:Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the...
分类:
其他好文 时间:
2015-06-20 15:36:39
阅读次数:
120
width=device-width :表示宽度是设备屏幕的宽度 initial-scale=1.0:表示初始的缩放比例 minimum-scale=0.5:表示最小的缩放比例 maximum-scale=2.0:表示最大的缩放比例 user-scalable=yes:表示用...
分类:
移动开发 时间:
2015-06-20 15:33:56
阅读次数:
150