码迷,mamicode.com
首页 >  
搜索关键字:maximum repetition s    ( 4177个结果
Leetcode#152 Maximum Product Subarray
原题地址简单动态规划,跟最大子串和类似。一维状态空间可以经过压缩变成常数空间。代码: 1 int maxProduct(int A[], int n) { 2 if (n = 0; i--) {10 int tmp = minp;11 ...
分类:其他好文   时间:2015-01-30 10:36:58    阅读次数:179
122.Best Time to Buy and Sell Stock II
Say you have an array for which the ith element isthe price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete as manytransactions as you like (ie, buy one an...
分类:其他好文   时间:2015-01-30 09:11:13    阅读次数:176
104.Maximum Depth of Binary Tree
Given a binary tree, findits maximum depth. The maximum depth is thenumber of nodes along the longest path from the root node down to the farthestleaf node.   可用递归,效率低。 这里用类似层次遍历的算法。设置一个队列和两个int变量...
分类:其他好文   时间:2015-01-30 09:10:56    阅读次数:261
欧拉计划(python) problem 18
Maximum path sum I Problem 18 By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23. 3 7 4 2 4 6 8 5 9 ...
分类:编程语言   时间:2015-01-29 14:38:58    阅读次数:330
PAT1007. Maximum Subsequence Sum
Given a sequence of K integers { N1, N2, ..., NK}. A continuous subsequence is defined to be { Ni, Ni+1, ..., Nj} where 1 2 const int MAXX=10010; 3 i....
分类:其他好文   时间:2015-01-29 14:04:23    阅读次数:177
PAT Advanced Level 1007
1007. Maximum Subsequence Sum (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Given a sequence of K integers { N...
分类:其他好文   时间:2015-01-29 09:30:29    阅读次数:131
Best Time to Buy and Sell Stock III
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. 注意 You may n...
分类:其他好文   时间:2015-01-28 14:47:27    阅读次数:197
LeetCode --- 5. Longest Palindromic Substring
题目链接: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 palindromic ...
分类:其他好文   时间:2015-01-27 23:35:02    阅读次数:144
34: Maximum Depth of Binary Tree
/************************************************************************/ /* 34: Maximum Depth of Binary Tree */ /*********************************.....
分类:其他好文   时间:2015-01-27 23:07:10    阅读次数:210
[LeetCode]53.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,1,?5,4], the contiguous subarray [4,...
分类:其他好文   时间:2015-01-27 21:59:43    阅读次数:145
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!