Happiness is more than pleasure without pain

你只有非常努力,才能看起来毫不费力

导航

2014年9月20日 #

Reverse Integer

摘要: import java.util.*;public class Solution { public static int reverse(int x) { int a=x,tmp=0,i; int []b=new int[32]; for(i=0;i=0;j--){ tmp+=b[j]... 阅读全文

posted @ 2014-09-20 10:04 believer 阅读(109) 评论(0) 推荐(0) 编辑

递归与迭代

摘要: (递推算法的首要问题是得到相邻的数据项间的关系(即递推关系)。递推算法避开了求通项公项的麻烦,把一个复杂的问题的求解,分解成了连续的若干步简单运算。一般说来,可以将递推算法看成是一种特殊的迭代算法。) 递归(调用本身)与迭代(新值换旧值)都是基于控制结构:迭代用重复结构,而递归用选择结构。... 阅读全文

posted @ 2014-09-20 09:00 believer 阅读(302) 评论(0) 推荐(0) 编辑

Maximum Depth 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... 阅读全文

posted @ 2014-09-20 08:34 believer 阅读(72) 评论(0) 推荐(0) 编辑