码迷,mamicode.com
首页 >  
搜索关键字:maximum sum subarray    ( 25087个结果
[leetcode]_Path Sum I && II
都是考查DFS。经典回溯算法,问题在于我对该类型的代码不熟悉,目前以参考别人的代码,然后加上自己的实现为主,通过类似的题目加强理解。一、给定一棵二叉树,判断是否存在从root到leaf的路径和等于给定值sum,存在返回true,否则返回false。思路:DFS。代码: 1 private b...
分类:其他好文   时间:2014-05-28 23:51:25    阅读次数:389
LeetCode123: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 co...
分类:其他好文   时间:2014-05-28 22:37:18    阅读次数:327
leetcode -- 3sum
Given an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:Elemen...
分类:其他好文   时间:2014-05-28 16:47:30    阅读次数:308
[Java]_函数传参的疑惑与思考
问题来源于leetcode上的两道题 Path Sum I && II,分别写了两个dfs。1 void dfs(TreeNode node , int sum , ArrayList curPath)2 void dfs(TreeNode node , int sum , boolean ifEx...
分类:编程语言   时间:2014-05-28 13:11:14    阅读次数:361
mysql中 int(M)中M
http://dev.mysql.com/doc/refman/5.0/en/numeric-type-overview.html 这个M 就是maximum display width。那什么是maximum display width?看了下面的例子很容易说明了,注意zerofill :my.....
分类:数据库   时间:2014-05-28 04:07:12    阅读次数:314
LeedCode --- Best Time to Buy and Sell Stock
题目链接题意: find the maximum positive difference between the price on the ith day and the jth day附上代码: 1 class Solution { 2 public: 3 int maxProfit(ve...
分类:其他好文   时间:2014-05-28 03:49:45    阅读次数:307
[leetcode]Minimum Path Sum @ Python
原题地址:https://oj.leetcode.com/problems/minimum-path-sum/题意:Given amxngrid filled with non-negative numbers, find a path from top left to bottom right w...
分类:编程语言   时间:2014-05-28 03:03:13    阅读次数:320
LeetCode122:Best Time to Buy and Sell Stock II
题目: 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 co...
分类:其他好文   时间:2014-05-28 00:53:26    阅读次数:338
[leetcode]Path Sum @ Python
原题地址:https://oj.leetcode.com/problems/path-sum/题意:Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all...
分类:编程语言   时间:2014-05-26 18:37:11    阅读次数:295
57. 数对之差的最大值:4种方法详解与总结[maximum difference of array]
maximum/largest difference of array
分类:其他好文   时间:2014-05-26 17:07:38    阅读次数:332
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!