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 ...
随机推荐
- NotifyIcon实现托盘程序
NotifyIcon 控件的常用属性属性:Icon类型:System.Drawing.Icon说明:将在系统任务栏中显示的图标.可以在设计时指定,也可在运行时动态指定.属性:Text类型:String ...
- Professional layer CodeForces - 1103D (状压,gcd)
大意: 给定$n$元素序列$a$, 现在想要让$gcd(a_1,a_2,...,a_n)=1$. 对于每个$a_i$可以除以一个不超过$k$的因子, 代价为$e_i$, 假设一共选择了$x$个元素去除 ...
- Connecting Vertices CodeForces - 888F (图论,计数)
链接 大意: 给定邻接表表示两点是否可以连接, 要求将图连成树, 且边不相交的方案数 n范围比较小, 可以直接区间dp $f[l][r]$表示答案, $g[l][r]$表示区间[l,r]全部连通且l, ...
- Leetcode 22
//这题感觉不如前两题回溯清楚,还要再看看class Solution { public: vector<string> generateParenthesis(int n) { vect ...
- PHP 的 HTTP 认证机制
PHP 的 HTTP 认证机制仅在 PHP 以 Apache 模块方式运行时才有效,因此该功能不适用于 CGI 版本.在 Apache 模块的 PHP 脚本中,可以用 header()函数来向客户端浏 ...
- 【转】EntityFramework动态组合Lambda表达式作为数据筛选条件,代替拼接SQL语句
传统的操作数据库方式,筛选数据需要用StringBuilder拼接一大堆的WHERE子句. 在Entity Framework中,代码稍有不慎就会造成巨大性能消耗,如: using(var db=ne ...
- 获取当前目录getcwd,设置工作目录chdir,获取目录信息
#include <unistd.h> #include <stdio.h> #include <limits.h> int main(int argc, char ...
- 从零开始学习Vue(一)
因为最近有个项目的需求是,微信公众号+IOS/Android APP, 界面都很类似. 以往的做法是APP是调用JSON接口,后台只负责提供接口. 而H5,我以前都是用Jquery,用来写手机网站总是 ...
- 获取URL的数据
<!doctype html><html><head><meta charset="utf-8"><meta name=&qu ...
- HeadFirstJava
java执行过程的来龙去脉 源代码——编译器——输出——java虚拟机 扩展名为.java ——扩展名为.class 不要直接用类名点变量来改变属性值,一般都用get.set方法.封装的基本原则:将你 ...