摘要: 4 阅读全文
posted @ 2019-11-05 10:02 ofmou 阅读(41) 评论(0) 推荐(0)
摘要: 操作给定的二叉树,将其变换为源二叉树的镜像 /** public class TreeNode { int val = 0; TreeNode left = null; TreeNode right = null; public TreeNode(int val) { this.val = val; 阅读全文
posted @ 2019-10-24 15:17 ofmou 阅读(83) 评论(0) 推荐(0)
摘要: 5 阅读全文
posted @ 2019-10-18 08:15 ofmou 阅读(40) 评论(0) 推荐(0)
摘要: 3 阅读全文
posted @ 2019-09-15 10:45 ofmou 阅读(46) 评论(0) 推荐(0)
摘要: 2 阅读全文
posted @ 2019-09-11 19:30 ofmou 阅读(64) 评论(0) 推荐(0)
摘要: 1 阅读全文
posted @ 2019-08-30 15:43 ofmou 阅读(65) 评论(0) 推荐(0)
摘要: 题目: 给定一个数组A[0,1,...,n-1],请构建一个数组B[0,1,...,n-1],其中B中的元素B[i]=A[0]*A[1]*...*A[i-1]*A[i+1]*...*A[n-1]。不能使用除法。(注意:规定B[0] = A[1] * A[2] * ... * A[n-1],B[n-1 阅读全文
posted @ 2019-08-10 21:20 ofmou 阅读(86) 评论(0) 推荐(0)
摘要: 题目描述 大家都知道斐波那契数列,现在要求输入一个整数n,请你输出斐波那契数列的第n项(从0开始,第0项为0,第1项是1)。 n<=39 题目分析 斐波那契数列的第n项为f(n),第n-1项为f(n-1),第n-2项为f(n-2)。 f(n)=f(n-1)+f(n-2)。 public class 阅读全文
posted @ 2019-07-30 15:35 ofmou 阅读(83) 评论(0) 推荐(0)
摘要: 题目描述 一只青蛙一次可以跳上1级台阶,也可以跳上2级。求该青蛙跳上一个n级的台阶总共有多少种跳法(先后次序不同算不同的结果)。 题目分析 1. target为1或者为0时,分别有1种和0种跳法。 2. target-2的递归的终止条件不能设置为 target == 1,因为可能取不到而导致递归不能 阅读全文
posted @ 2019-07-01 15:24 ofmou 阅读(46) 评论(0) 推荐(0)