// you can also use imports, for example:
// import java.util.*; // you can write to stdout for debugging purposes, e.g.
// System.out.println("this is a debug message"); class Solution {
public int solution(int N) {
// write your code in Java SE 8
int tempMod=0;
int length=0;
int posOne=-1;
int step=0;
while(N>0){
tempMod=(N%2);
if(tempMod==1){ if(posOne>=0){
length=(length < (step-posOne-1))?(step-posOne-1):length;
}
posOne=step;
} step++;
N=(N/2);
}
return length;
}
}
public int solution(int[] A) {
// write your code in Java SE 8
int i=0;
int result=0;
while(i<A.length){ result=(result^A[i]);
i++;
}
return result;
}
// you can also use imports, for example:
// import java.util.*; // you can write to stdout for debugging purposes, e.g.
// System.out.println("this is a debug message"); class Solution {
public int[] solution(int[] A, int K) {
// write your code in Java SE 8
int[] newA = new int[A.length];
int i=0;
while(i<A.length){
newA[(i+K)%(A.length)]=A[i];
i++;
} return newA;
}
}

最新文章

  1. Java服务器对外提供接口以及Android端向服务器请求数据
  2. 三:关于tcp
  3. 《Pro Express.js》学习笔记——概述
  4. OpenCV阶段总结扩充。
  5. PRML读书会第三章 Linear Models for Regression(线性基函数模型、正则化方法、贝叶斯线性回归等)
  6. POJ-2886 Who Gets the Most Candies?(线段树+模拟)
  7. Coder-Strike 2014 - Round 1(A~E)
  8. 控制反转(IoC)与依赖注入(DI)
  9. HDU 1394 Minimum Inversion Number (数据结构-段树)
  10. wcf例子01
  11. unity3dWeb版文本转语音
  12. php 执行效率
  13. Bootstrap3写的红色警告框样式组件
  14. 【原】使用IDEA创建Maven工程时提示&quot;...xxx/pom.xml already exists in VFS&quot;的解决
  15. C#十进制与任意进制的转换
  16. 你好,我是梁桐铭,.NET程序员,啰嗦下过去几年来的感悟吧
  17. Flask-WTF中的csrf保护
  18. cordova打包vue2(webpack)android、ios app
  19. 梯度下降法的三种形式BGD、SGD以及MBGD
  20. linux 下的常用操作命令

热门文章

  1. isee图片专家批量处理图片大小教程
  2. socks v5 协议解析
  3. tomcat7 的The Apache Tomcat Native library which allows optimal performance 的解决
  4. soap使用xml调用webapi后返回xml信息进行JSON转换处理,以顺丰查询接口为例
  5. Codeforces 758B Blown Garland
  6. CentOS 5.6怎么安装MongoDB数据库?
  7. OpenMP常用函数
  8. 一、初始Object-C
  9. 1、SpringBoot+MybatisPlus整合
  10. orale 10g和11g中的自动统计任务