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 ...
随机推荐
- 为什么需要API网关?
目录 0:00 微服务与网关(Microservices & API Gateways) 大家好,我叫Macro,今天我们谈论有关微服务和网关的话题.我是Mashape的CTO,也同时是开源网 ...
- WPF中的Style(风格,样式)
作者: 周银辉 来源: 博客园 发布时间: 2009-02-27 15:04 阅读: 6698 次 推荐: 0 原文链接 [收藏] 在WPF中我们可以使用Style来设置控件的某些 ...
- 20170724wdVBA正则表达式提取答案到Excel
Public Sub RegExtractData() Dim StartTime, UsedTime StartTime = VBA.Timer Dim FilePath$ Dim FileName ...
- 在 Confluence 6 中连接一个 LDAP 目录
希望将 Confluence 连接到一个 LDAP 目录: 在屏幕的右上角单击 控制台按钮 ,然后选择 General Configuration 链接. 在左侧的面板中单击 用户目录(User Di ...
- 44 CSS 浮动 模态框 定位
一.浮动 float : 浮动的盒子不占原来的位置,其下方的盒子会上移 父盒子会发生塌陷现象.同一级盒子right浮动,同级左边的盒子需要左浮动,right浮动的盒子才能上来 由于浮动框不在文档的普通 ...
- 正睿 2019 省选附加赛 Day1 T1 考考试
比较奇怪的一个枚举题. 注意到10=2*5,所以10^k的二进制表示一定恰好在末尾有k个0. 考虑从小到大去填这个十进制数. 填的时候记录一下当前的二进制表示. 每次尝试去填0或者10^k. 如果要填 ...
- 解决执行脚本报syntax error: unexpected end of file或syntax error near unexpected token `fi'错误的问题
参考:https://blog.csdn.net/u012453843/article/details/69803244 解决执行脚本报syntax error: unexpected end of ...
- python-day52--前端html、css
一.html需掌握的: 1. img标签 属性:src alt title width height 2. a标签 属性:href target 3. ul 标签及li 标签,二者都是块级标签 ul ...
- CF-499div2-E-裴蜀定理
E. Border time limit per test 1 second memory limit per test 256 megabytes input standard input outp ...
- EchoService
dubbo为consumer端的代理对象实现了EchoService接口. 使用示例: <dubbo:reference id="hello" interface=" ...