Navie level questions
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的更多相关文章
- Layout Team
The layout team is a long-term engineering team tasked with maintaining, supporting, and improving t ...
- [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 ...
- WCF学习系列三--【WCF Interview Questions – Part 3 翻译系列】
http://www.topwcftutorials.net/2012/10/wcf-faqs-part3.html WCF Interview Questions – Part 3 This WCF ...
- [转]Design Pattern Interview Questions - Part 4
Bridge Pattern, Composite Pattern, Decorator Pattern, Facade Pattern, COR Pattern, Proxy Pattern, te ...
- [转]Design Pattern Interview Questions - Part 1
Factory, Abstract factory, prototype pattern (B) What are design patterns? (A) Can you explain facto ...
- cassandra-replication_factor 和 consistency level
参考 replication_factor 决定了数据会被写到多少个节点.为2表示要写到两个节点. consistency level决定客户端要等待多少个节点被写成功.为1表示只要第一个节点被写成功 ...
- investopedia level 2
Mispricing can be explained by the sum of the two components: true mispricing and estimation errorVe ...
- How To Ask Questions The Smart Way
How To Ask Questions The Smart Way Eric Steven Raymond Thyrsus Enterprises <esr@thyrsus.com> R ...
- 【Binary Tree Level Order Traversal】cpp
题目: Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to ri ...
随机推荐
- Centos nginx安装
1.下载nginx http://nginx.org/en/download.html 2.上传到服务器上,并解压: rz 后选择上传的文件 tar -zxvf /fish/download/ngin ...
- leetcode322
public class Solution { public int coinChange(int[] coins, int amount) { ) ; ]; dp[] = ; ;i <= am ...
- centos 7设置本地yum资源库
前言 同样的,是在这两天安装ambari的时候遇到的问题之一,那就是关于centos的本地yum源的制作,当时是一种是制作iso镜像的yum源,还有一种将rpm软件包打成压缩包上传到centos的某一 ...
- ligbox 插件介绍
浏览器支持情况:一般情况都支持.最好是jQuery v1.x + lightbox.js,这样的组合IE6,IE7,IE8也支持! 1 light插件的下载地址:https://pan.baidu.c ...
- ztree带有选项框的树形菜单使用
1.ztree简介 zTree 是一个依靠 jQuery 实现的多功能 “树插件”.优异的性能.灵活的配置.多种功能的组合是 zTree 最大优点.专门适合项目开发,尤其是 树状菜单.树状数据的Web ...
- easyui多图片上传+预览切换+支持IE8
引入css和js: <link href="${pageContext.request.contextPath}/plugin/dialog/dialog.css" rel= ...
- springboot整合dubbox与zookeeper
springboot中dubbo依赖的引入和配置(application.properties)参见:https://blog.csdn.net/wohaqiyi/article/details/72 ...
- redis、mysql、mongdb的比较
特点: 1-1 MySQL:1. 使用c和c++编写,并使用了多种编译器进行测试,保证源代码的可移植性2. 支持多种操作系统3. 为多种编程语言提供可API4. 支持多线程,充分利用CPU资源优化的S ...
- JAVA初学者的JDB 尝试
使用JDB调试简单递归程序 跟着娄老师的博客学习, 首先在终端使用Ctrl+Shift+T打开三个标签,方便操作. 使用Vim编辑自己的程序,练习程序如下 1 public class Factori ...
- 设计模式学习心得<抽象工厂模式 Abstract Factory>
抽象工厂模式(Abstract Factory Pattern)是围绕一个超级工厂创建其他工厂.该超级工厂又称为其他工厂的工厂.这种类型的设计模式属于创建型模式,它提供了一种创建对象的最佳方式. 在抽 ...