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 ...
随机推荐
- linux 机器之间 zssh, rz, sz互相传输
zssh的全名叫ZMODEM SSH.看名字就知道,使用的zmodem,我们习惯了SecureCRT,直接就可以用来发送文件,比使用scp方便很多. zmodem协议方便主要表示在以下点 其一,不需要 ...
- fastjson中对象转化为字符串时过滤某字段
fastjson中对象转化为字符串时过滤某字段,有两种方法: 一.在该字符定义上方添加"@JSONField(serialize=false)"注解: 二.调用含有Property ...
- Python3 复制和深浅copy
赋值: 列表的赋值: list1 = ['peter','sam'] list2 = list1 print(list1,id(list1)) print(list2,id(list2)) list1 ...
- jquery之find,filter,has对比
find()方法找的是符合条件的后代,返回的是子元素. $('div').find('.intro').css('color','red'); //寻找div后代类为intro的元素 filter() ...
- 微商城项目 请求接口封装中出现 callback && callback() 原理
http://www.imooc.com/wenda/detail/522579 因为逻辑运算符&& ||通常具有短路求值的特性即,如果只求部分值就可以得到整个表达式的值,那么剩下的部 ...
- SpringCloud-day01-简介
1.spring cloud简介 Spring Cloud是一系列框架的有序集合.它利用Spring Boot的开发便利性巧妙地简化了分布式系统基础设施的开发,如服务发现注册.配置中心.消息总线.负载 ...
- Appium 学习一:环境搭建问题
1.安装Android-sdk http://tools.android-studio.org/index.php/sdk 问题1:下载 android-sdk_r24.4.1-windows.zip ...
- 20162322 朱娅霖 作业005&006 栈,队列
20162322 2017-2018-1 <程序设计与数据结构>第五.六周学习总结 教材学习内容总结 集合的介绍(总述) 集合是收集并组织其他对象的对象.主要分为线性集合(集合中的元素排成 ...
- 360浏览器对CSS的补齐
360浏览器对很多CSS不兼容,导致了很多代码显示不正常, 常见的解决方法: 很多人在源代码加了<meta content=\"IE=edge\" http-equiv=\& ...
- 关于php条形码生成(barcode),修改样式
今天听错了需求,以为要重新设计条形码,第一次制作这个,经过搜索使用的barcode这个第三方的,具体使用步骤网上很多就不在这里详细介绍了.主要是今天遇到的样式修改问题: barcode经过查看是无法自 ...