1. Binary Tree Maximum Node

Find the maximum node in a binary tree,return the node.

 public class MaximumNode{
public TreeNode maxNode(TreeNode root){
if(root == null) return root;
TreeNode left = maxNode(root.left);
TreeNode right = maxNode(root.right);
return max(root,max(left,right));
}
public TreeNode max(TreeNode node,TreeNode anotherNode){
if(node == null) return anotherNode;
if(anotherNode == null) return node;
if(node.val > anotherNode.val) return node;
return anotherNode;
}
}

Navie level questions的更多相关文章

  1. Layout Team

    The layout team is a long-term engineering team tasked with maintaining, supporting, and improving t ...

  2. [Node.js]33. Level 7: Persisting Questions

    Let's go back to our live-moderation app and add some persistence, first to the questions people ask ...

  3. WCF学习系列三--【WCF Interview Questions – Part 3 翻译系列】

    http://www.topwcftutorials.net/2012/10/wcf-faqs-part3.html WCF Interview Questions – Part 3 This WCF ...

  4. [转]Design Pattern Interview Questions - Part 4

    Bridge Pattern, Composite Pattern, Decorator Pattern, Facade Pattern, COR Pattern, Proxy Pattern, te ...

  5. [转]Design Pattern Interview Questions - Part 1

    Factory, Abstract factory, prototype pattern (B) What are design patterns? (A) Can you explain facto ...

  6. cassandra-replication_factor 和 consistency level

    参考 replication_factor 决定了数据会被写到多少个节点.为2表示要写到两个节点. consistency level决定客户端要等待多少个节点被写成功.为1表示只要第一个节点被写成功 ...

  7. investopedia level 2

    Mispricing can be explained by the sum of the two components: true mispricing and estimation errorVe ...

  8. How To Ask Questions The Smart Way

    How To Ask Questions The Smart Way Eric Steven Raymond Thyrsus Enterprises <esr@thyrsus.com> R ...

  9. 【Binary Tree Level Order Traversal】cpp

    题目: Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to ri ...

随机推荐

  1. py库:把python打包成exe文件(pyinstaller)

    http://blog.csdn.net/be_quiet_endeavor/article/details/73929077 用Pyinstaller把Python3.4程序打包成可执行文件exe ...

  2. list按照某个元素进行排序

    import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.u ...

  3. 爬虫 1 requests 、beautifulsoup

    1.requests 1.method 提交方式:post.get.put.delete.options.head.patch 2.url 访问地址 3.params 在url中传递的参数,GET p ...

  4. R语言-散点图阵

    1.pairs()函数 > pairs(iris[,1:4]) #取iris数据集的第一列到第四列两两作图 2.plot()函数 > plot(iris[,1:4], + main=&qu ...

  5. C++中的inline用法

     

  6. Scrapy反爬

    1,随机更换 user-agent: 将足够多的user-agent放在settings中,在parse方法中调用 缺点:每一个request中都要调用这个方法 这个是scrapy的流程图. 既然每一 ...

  7. 微擎开发------day01

    微擎的数据常量 $_GPC   -- 全局请求变量 类型: array 说明: 合并请求参数, 包括 $_GET, $_POST, $_COOKIE的内容. 相同键名覆盖规则为 $_COOKIE 覆盖 ...

  8. 查看sql 语句io执行情况

    set statistics io,time on 表 'xx'.扫描计数 1,逻辑读取 19 次,物理读取 0 次,预读 0 次,lob 逻辑读取 76 次,lob 物理读取 0 次,lob 预读 ...

  9. Difference Among Mercedes Star Diagnostic Tool MB Star C3 C4 C5 C6

    Mercedes Star Diagnostic Tool newly update to MB Star C6.There are many star diangostic tool in the ...

  10. Some Websites To Learning Laravel

    https://learninglaravel.net/ https://learnku.com/laravel