码迷,mamicode.com
首页 >  
搜索关键字:maximum subsequence    ( 5146个结果
LeetCode OJ - Minimum && Maximum Depth of Binary Tree
这两道题用递归的解法都很简单,只是稍有不同。下面是AC代码: 1 /** 2 * Given a binary tree, find its minimum depth. 3 * the minimum depth is the number of nodes along th...
分类:其他好文   时间:2014-05-10 08:47:32    阅读次数:271
LeetCode OJ - Distinct Subsequence
这道题采用动态规划,可是我一开始没有想到。后来参考了discuss中前辈的代码和思路,才想通的。 方法二是因为每一步只和上一步的内容相关,所以可以只用O(n)的空间复杂度。下面是AC代码: 1 /** 2 * Solution DP 3 * we keep a m*n matri...
分类:其他好文   时间:2014-05-10 08:43:12    阅读次数:319
Leetcode: Minimum Depth of Binary Tree
这道题因为不仔细的缘故两次过,与Maximum Depth of Binary Tree问题类似,区别在于这个问题中,如果一个节点左子树为空、右子树有值,则该节点的深度应取决于右子树,而不能直接取min{左,右} 1 /** 2 * Definition for binary tree 3 * .....
分类:其他好文   时间:2014-05-10 01:40:13    阅读次数:293
·DP」知识点整理
一.最长公共子序列(LCS Longest Common Subsequence)第一,先说区别,最长公共子串和最长公共子序列是不一样的。最长公共子串不许是连续的,而最长公共子序列可以是不联系的。网络上解释的子序列:一个字符串S,去掉零个或者多个元素所剩下的子串称为S的子序列。最长公共子序列就是寻找...
分类:其他好文   时间:2014-05-10 01:12:20    阅读次数:370
Leetcode | Binary Tree Maximum Path Sum
Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below binary tree, 1 ...
分类:其他好文   时间:2014-05-07 09:36:09    阅读次数:300
leetcode第一刷_Binary Tree Maximum Path Sum
这是道好题。...
分类:其他好文   时间:2014-05-07 06:33:00    阅读次数:284
小强的HTML5移动开发之路(52)——jquerymobile中的触控交互
当使用移动设备进行触控操作时,最常用的就是轻击、按住屏幕或者手势操作,jQuery Mobile可以通过绑定的触控事件来响应使用者的特定触控行为。一、轻击与按住直接上代码(一切皆在代码中,细细品吧!) 练习 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1....
分类:移动开发   时间:2014-05-07 04:45:59    阅读次数:426
小强的HTML5移动开发之路(50)——jquerymobile页面初始化过程
为了方便说明和更加直观的展示jquerymobile的页面初始化过程以及各个事件的触发过程,我绘制了一幅流程图:图中用红色框圈起来的是界面中的事件,测试代码如下: 练习 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;...
分类:移动开发   时间:2014-05-07 04:40:07    阅读次数:450
hdu 1530 Maximum Clique_最大团模板
最大团模板...
分类:其他好文   时间:2014-05-04 09:49:41    阅读次数:335
hud-3530-Subsequence-维护两个单调队列
维护两个单调队列,一个存储当前点之前的最大值。 另外一个存储当前点之前的最小值。 若最大值与最小值之间的差大于k,那么就把最大值和最小值中位置靠前的往后移。 #include #include #include #include #include using namespace std; //#define INF ((1<<30)-1) #define INF 0xfffff #defin...
分类:其他好文   时间:2014-05-04 09:23:04    阅读次数:372
5146条   上一页 1 ... 511 512 513 514 515 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!