注册账号 登录
小春网 返回首页

tree77heaven的个人空间 https://www.incnjp.com/?294237 [收藏] [复制] [分享] [RSS]

日志

codility 3

已有 197 次阅读2017-3-13 17:19 |个人分类:codility|系统分类:学习

// 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 Solution3 {

public static void main(String[] args){


String S="aaaaa";
int iret=-1;
String newS="";
newS=S;

if (S.length()<=2){
if(S.length()<=0){

}else if(S.length()==1){
iret=0;
}else if(S.length()==2){

}
}else{

int i;


for( i=1;i<=S.length()-1;i++){
newS=" " + newS;
}





     for( i=newS.length()/2;i<=newS.length()-2;i++){
     if(newS.substring(i-1, i).equals(" ")){

     }else{

     for(int j=i;j<=newS.length()-2;j++){

     }
     if(newS.substring(i-1, i).equals(newS.substring(i+1, i+2))){

    iret=i-newS.length()/2;
    break;

     }
     }



    }


     }

 System.out.println(iret);
}

}



悲剧

无聊

震惊

支持

不解

超赞

愤怒

高兴

全部作者的其他最新日志

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 注册账号

小春网
常务客服微信
微信订阅号
手机客户端
扫一扫,查看更方便! 返回顶部