Microsoft - Find Biggest Node

public Node findBiggest (Node n1, Node n2){
Node c1 = n1;
Node c2 = n2;
boolean isPositive = false;
if(n1.value == '-'){
if(n2.value != '-'){
return n2;
}
c1=n1.next;
if(n2.value == '-'){
isPositive = false;
c2=n2.next;
}
}
else{
if(n2.value == '-'){
return n1;
}
isPositive = true;
if(n2.value == '+'){
c2 = n2.next;
}
if(n1.value == '+'){
c1 = n1.next;
}
}
while(c1 != null && c2 != null){
int d1 = c1.value - '0';
int d2 = c2.value - '0';
if(d1 > d2){
if(isPositive){
return n1;
}
else{
return n2;
}
}
else if(d1 < d2){
if(isPositive){
return n2;
}
else{
return n1;
}
}
else{
c1 = c1.next;
c2 = c2.next;
}
}
if(c2 != null && isPositive){
return n2;
}
if(c2 != null && !isPositive){
return n1;
}
if(c1 != null && isPositive){
return n1;
}
if(c1 != null && !isPositive){
return n2;
}
return null;
}
Microsoft - Find Biggest Node的更多相关文章
- microsoft webMatrix 使用 IISnode 进行node express 开发
微软的microsoft webMatrix是一个免费的开发工具,我们可以使用它进行node 开发并利用iisnode 模块进行iis 的nodejs网站的维护,还是比较方便的. 一个简单的node ...
- Installing node-oracledb on Microsoft Windows
版本 7 由 Laura Ramsey-Oracle 于 2015-10-19 下午11:46创建,最后由 cj 于 2015-10-22 下午7:44修改. Installing node-orac ...
- Win10下 VS2017 安装失败 未能安装包“Microsoft.VisualStudio.AspNet45.Feature,version=15.0.26208.0”
事情的起因是这样的,前段时间,VS2017发布当天,想在自己的Win10上安装VS2017,然而,由于自己的系统很久没有更新(PS:自己关闭了Windows更新). 安装提示:未能安装包“Micros ...
- GitHub实战系列~3.提交github的时候过滤某些文件 2015-12-10
GitHub实战系列汇总:http://www.cnblogs.com/dunitian/p/5038719.html ———————————————————————————————————————— ...
- The .NET of Tomorrow
Ed Charbeneau(http://developer.telerik.com/featured/the-net-of-tomorrow/) Exciting times lie ahead f ...
- Leetcode: K-th Smallest in Lexicographical Order
Given integers n and k, find the lexicographically k-th smallest integer in the range from 1 to n. N ...
- 【官档整理】Visual Studio 2017 VS2017 中文离线安装包下载
[官档整理]Visual Studio 2017 VS2017 中文离线安装包下载 转 https://blog.csdn.net/fromfire2/article/details/81104648 ...
- 浅谈一下mshta在CVE-2017-11882里的命令构造
Evi1cg同学前不久放出CVE-2017-11882的一个 python利用脚本,地址在https://github.com/Ridter/CVE-2017-11882/,不过其中一个版本里边有一个 ...
- git忽略除指定文件/指定后缀名文件外的文件
不需要从头写.gitignore文件,GitHub已经为我们准备了各种配置文件,只需要组合一下就可以使用了.所有配置文件可以直接在线浏览:https://github.com/github/gitig ...
随机推荐
- mysql 将一张表里的数据插入到另一张表
1. 表结构一样 insert into 表1 select * from 表2 2. 表结构不一样 insert into 表1 (列名1,列名2,列名3) select 列1,列2,列3 from ...
- homestead 暴露接口到外网
laravel 官方推荐的运行环境是homestead,但homestead是个虚拟机,你自己访问没问题,给别人联调怎么办? 一个大型项目肯定不止一个人开发,这个时候就需要将你虚拟机上的接口暴露给外网 ...
- 『Python』图像金字塔、滑动窗口和非极大值抑制实现
图像金字塔 1.在从cv2.resize中,传入参数时先列后行的 2.使用了python中的生成器,调用时使用for i in pyramid即可 3.scaleFactor是缩放因子,需要保证缩放后 ...
- Leetcode 113
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode ...
- 字符串练习——唐纳德与子串 (Easy)
G1. 唐纳德与子串 (Easy) Time limit per test: 1.0 seconds Memory limit: 256 megabytes 子串的定义是在一个字符串中连续出现的一段字 ...
- quartz---的一个简单例子
quartz---的一个简单例子 首先建立一个maven项目.jar工程即可.(提示:我前面有如何建立一个maven工程的总结以及maven环境的配置.) 1.建立好后点击到app中运行,--> ...
- en_a
1◆ai ay ei 2◆ au aw ɔː 3◆ a eɪ æ ɑː ɔː ʌ 4◆ ar ɔː ɑː ɜː 5◆ al ɑː ɔː 6◆ are air ...
- PHP:第四章——PHP数组array_intersect计算数组交集
<pre> <?php //array_intersect计算数组交集 header("Content-Type:text/html;charset=utf-8" ...
- windows 环境下python 安装 pypcap 并用pyinstaller打包到exe,解决DLL 加载失败。
安装 PYQT5 pypcap 环境: windows10_x64 python3.6.3 pycharm2017.2.4 备注: 需要安装 Visual C++ Build Tools 2015 可 ...
- struts2.properties
#action后缀struts.action.extension=action#上传文件的工作目录与文件的最大尺寸struts.multipart.saveDir=struts.multipart.m ...