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 ...
随机推荐
- nginx ------反向代理和负载均衡
最近由于公司的业务增长 服务器承受不住压力经常出现崩溃现象 为了解决 使用nginx的负载均衡解决,以下是操作步骤: 1.nginx 的负载均衡:将压力分散到不同的机器上 nginx不单可以作为强大的 ...
- git中提交了想要忽略的文件,如何在删除
我们在用git的时候,有时会不小心将不需要文件跟踪的文件(如.classpath文件.project等)提交到git的服务器,这时候要忽略这些文件的做法是: 1.修改.gitignore文件 按照规则 ...
- leetcode142
public class Solution { public ListNode detectCycle( ListNode head ) { if( head == null || head.next ...
- 【转】完整精确导入Kernel与Uboot参与编译了的代码到Source Insight,Understand, SlickEdit
The linux kernel and u-boot contains lots of files, when we want to broswe the source code,we just w ...
- 关于Bootstrap的入门知识
问:Bootstrap是什么? 答:开源的前端框架,就是一些事先写好的css.js等. 问:Bootstrap在哪儿下载? 答:官方(https://getbootstrap.com/),中文(htt ...
- python中类与对象及其绑定方法的定义
面向对象编程 什么是面向对象? 面向过程:将需要解决的问题按步骤划分,一步一步完成每一个步骤,而且 步骤之间有联系. 优点:复杂问题可以分步完成 缺点:扩展性很差,维护性差.如果中间 ...
- nexus的安装和简介
下载nexus Nexus 是Maven仓库管理器,通过nexus可以搭建maven仓库,同时nexus还提供强大的仓库管理功能,构件搜索功能等. 下载Nexus, 下载地址:http://www.s ...
- 在delphi中XLSReadWriteII.组件的应用实例(1)
第三方组件:XLSReadWriteII.v.5.20.67_XE3 实例源码如下: unit Unit1; interface uses Winapi.Windows, Winapi.Message ...
- myeclise 安装
安装.破解步骤都在gaobo百度云/工具/开发工具 安装后配置环境变量:
- Node2.js
Node.js简单爬虫的爬取,也是跟着慕课网上抄的,网站有一点点改动,粘上来好复习嘛 var http = require('http') var cheerio = require('cheerio ...