码迷,mamicode.com
首页 >  
搜索关键字:maximum    ( 4142个结果
Maximum Subarray
本文是在学习中的总结,欢迎转载但请注明出处:http://blog.csdn.net/pistolove/article/details/43989997 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...
分类:其他好文   时间:2015-02-28 21:39:28    阅读次数:164
[LeetCode]Max Points on a Line
Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. 以某个点为基点,求得与其他的点的斜率并记录在map,注意两点 1.斜率可能为无穷 2.如果遍历到的点与基点在相同位置则所有斜率的点都要加上1 /** * Definition f...
分类:其他好文   时间:2015-02-27 21:34:46    阅读次数:227
[LeetCode] MaximumDepth of Binary Tree
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 farthest le...
分类:其他好文   时间:2015-02-26 21:32:39    阅读次数:152
hdu 4635 强连通分量+缩点
http://acm.hdu.edu.cn/showproblem.php?pid=4635 Problem Description Give a simple directed graph with N nodes and M edges. Please tell me the maximum number of the edges you can add that the gr...
分类:其他好文   时间:2015-02-26 18:35:11    阅读次数:148
1007. Maximum Subsequence Sum (25)
Given a sequence of K integers { N1, N2, ..., NK }. A continuous subsequence is defined to be { Ni, Ni+1, ..., Nj } where 1 <= i <= j <= K. The Maximum Subsequence is the continuous subsequence which...
分类:其他好文   时间:2015-02-24 12:36:31    阅读次数:120
LeetCode 152. Maximum Product Subarray
动态规划。 dp[0][i]: A[0, ..., i-1]的maximum product subarray, dp[1][i]: A[0, ..., i-1)的minimum product subarray. 初始化dp[0][0] = dp[1][0] = A[0]. 递推公式: dp[0][i] = max(dp[0][i-1]*A[i], dp[1][i-1]*A[i])...
分类:其他好文   时间:2015-02-23 20:08:09    阅读次数:163
[LeetCode] Best Time to Buy and Sell Stock IV
Say you have an array for which the ithi^{th} element is the price of a given stock on day ii.Design an algorithm to find the maximum profit. You may complete at most k transactions.Note: You may not...
分类:其他好文   时间:2015-02-23 00:16:37    阅读次数:174
[LeetCode] Best Time to Buy and Sell Stock III
Say you have an array for which the ithi^{th} element is the price of a given stock on day ii.Design an algorithm to find the maximum profit. You may complete at most two transactions.Note: You may no...
分类:其他好文   时间:2015-02-22 18:31:15    阅读次数:181
Codeforces Round #221 (Div. 2) D. Maximum Submatrix 2 (思维题)
题目地址:codeforces 221 D 这场是人生中做的第一场CF中的D题。(当时只做出来了A题。。)过年之际回顾了一下,就顺便看了几道D题。现在做CF的D题在比赛时还是做不出来。但是赛后往往都可以自己做出来。据说D题能在比赛中稳出的话就可以区域赛银了。于是争取以后CF能稳出4道题吧。 这道题刚开始不该看标签的。。给的是DP。。于是就一直朝着DP方向想。但是感觉不像是DP。就换了个思路,就做...
分类:其他好文   时间:2015-02-20 20:54:25    阅读次数:178
[LeetCode] Best Time to Buy and Sell Stock IV 买卖股票的最佳时间之四
Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete a...
分类:其他好文   时间:2015-02-18 15:11:36    阅读次数:142
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!