Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the fol...
分类:
其他好文 时间:
2014-07-09 23:00:38
阅读次数:
208
每个函数都是Function类型的实例,而且都与其他引用类型一样具有属性和方法。由于函数是对象,因此函数名实际上也是一个指向函数对象的指针,不会与某个函数绑定。函数的声明有以下三种形式:function sum(num1,num2){return num1+num2;}//利用函数声明语法定义var...
分类:
Web程序 时间:
2014-07-09 21:17:30
阅读次数:
304
参考:http://blog.csdn.net/sum_rain/article/details/37085771Token,就是令牌,最大的特点就是随机性,不可预测。一般黑客或软件无法猜测出来。那么,Token有什么作用?又是什么原理呢?Token一般用在两个地方:1)防止表单重复提交、2)ant...
分类:
Web程序 时间:
2014-07-09 21:11:09
阅读次数:
200
题目
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent
a number.
An example is the root-to-leaf path 1->2->3 which represents the number 123.
Find ...
分类:
其他好文 时间:
2014-07-08 21:43:08
阅读次数:
219
深度优先搜索(DFS)是搜索算法的一种。最早接触DFS应该是在二叉树的遍历里面,二叉树的先序、中序和后序遍历实际上都属于深度优先遍历,实质就是深度优先搜索,后来在图的深度优先遍历中则看到了更纯正的深度优先搜索算法。
通常,我们将回溯法和DFS等同看待,可以用一个等式表示它们的关系:回溯法=DFS+剪枝。所以回溯法是DFS的延伸,其目的在于通过剪枝使得在深度优先搜索过程中如果满足了回...
分类:
其他好文 时间:
2014-07-08 20:34:20
阅读次数:
271
Problem Description:
Given an array S of n integers, are there elements a, b, c in S such that a + b + c =
0? Find all unique triplets in the array which gives the sum of zero.
Note:
El...
分类:
其他好文 时间:
2014-07-08 18:31:01
阅读次数:
159
二叉树的三种遍历有递归版本,和迭代版本。本文介绍一种新的思路。
参考了 http://coolshell.cn/articles/9886.html
在许多应用中,我们还需要对遍历本身进行抽象。假如有一个求和的函数sum,我们希望它能应用于链表,数组,二叉树等等不同的数据结构。这时,我们可以抽象出迭代器(Iterator)的概念,通过迭代器把算法和数据结构解耦了,使得通用算法能应用于不同类...
分类:
其他好文 时间:
2014-07-08 15:41:35
阅读次数:
176
Minimum Sum
Time Limit: 16000/8000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 2667 Accepted Submission(s): 609
Problem Description
You are given ...
分类:
其他好文 时间:
2014-07-06 12:26:41
阅读次数:
200
很简单的一道题,判断和为sum的路径是否存在。结果WA了两次,一次是由于没有考虑清楚深搜停止的条件,另外一次是由于没有考虑到Path必须是从root到leaf的。 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * ...
分类:
其他好文 时间:
2014-07-05 22:39:11
阅读次数:
253
非常简单的一个题,和path sum非常类似。 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *rig...
分类:
其他好文 时间:
2014-07-05 22:03:48
阅读次数:
251