算法
tianchuan900
这个作者很懒,什么都没留下…
展开
-
lintcode balanced binary tree 解题思路
给定一个二叉树,确定它是高度平衡的。此题的解题思路在于从底向上进行高度的计算,采用递归的方法来实现这一目的。 public int maxDepth(TreeNode root){ if(root == null){ return 0; } int left = maxDepth(root.left);原创 2017-09-07 22:24:13 · 168 阅读 · 0 评论 -
由lintcode 655题引发的小思考
Given two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2.十分基础的一道题,通过将字符串转化为数字进行计算后再转化为字符串输出。答案代码如下:public class Solution { /* * @param num1原创 2017-09-10 20:40:49 · 222 阅读 · 0 评论