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. 手把手教你如何用 OpenCV + Python 实现人脸识别

    下午的时候,配好了OpenCV的Python环境,OpenCV的Python环境搭建.于是迫不及待的想体验一下opencv的人脸识别,如下文. 必备知识 Haar-like 通俗的来讲,就是作为人脸特 ...

  2. python print格式化输出。

    python print格式化输出. 1. 打印字符串 print ("His name is %s"%("Aviad")) 效果: 2.打印整数 print ...

  3. leetcode19

    class Solution { public: ; ; ListNode* removeNthFromEnd(ListNode* head, int n) { ; ListNode* node = ...

  4. git的简单命令

    git pull 拉下最新版本. git add . git commit 输入提交信息 esc返回 :wq保存 git push .git保存着当前仓库的信息.git bash here的时候,要确 ...

  5. chrome不能浏览任何网页,提示配置proxy,Ubuntu

    自从在Ubuntu安装virtualbox以后,我的chrome浏览器就不能上网了,提示我检查proxy信息, 后面设置了noproxy就ok啦. 不用使用命令,一次设置,终身有效. 首先,安装gks ...

  6. tensorflow 升级后报错:ImportError: libcudnn.so.6: cannot open shared object file: No such file or directory

    我的tensorflow之前的版本是1.2的所以支持cudnn5,但是tensorflow1.3及以上就是支持cudnn6. 查看: /usr/local/cuda/lib64$ ls  libcud ...

  7. Django_Form验证(一)

    Django为我们提供了一个模板来做Form验证,不需要我们再去写复杂的验证代码了 简单的提交信息html页面: <form action="/fff/Form" metho ...

  8. python 网络编程 tcp和udp 协议

    1. 网络通信协议 osi七层,tcp\ip五层 tcp\ip五层 arp协议:通过IP地址找到mac地址 2.tcp和udp的区别 tcp协议:面向连接,消息可靠,相对udp来讲,传输速度慢,消息是 ...

  9. 利用iptables防火墙允许1521端口被连接

    今天在虚拟机上装了ora11g , 出现2个问题 1.i386的几个RPM包缺少导致安装验证不通过 2.安装完成后,本地电脑连不上虚拟机oracle , 但是能ping通 问题2: 简单的方法就是关掉 ...

  10. uvm_pre_do

    https://blog.csdn.net/tingtang13/article/details/46535649 1.uvm_do 封装了一系列接口,封装越多,灵活性越差.所以增加了三个接口:pre ...