public int commonTwo(String[] a, String[] b) {
int startA=0;
int startB=0;
int count=0; while((( startA < a.length ) && ( startB < b.length )))
{
if(startA >0){
if(a[startA].equals(a[startA-1])){
startA++;
continue;
}
}
if(startB >0){
if(b[startB].equals(b[startB-1])){
startB++;
continue;
}
} if( a[startA].equals(b[startB]) ){
count++;
startA++;
startB++;
}
else if( (a[startA].compareTo(b[startB])) < 0 ){
startA++;
}
else{
startB++;
} }
return count; }

http://codingbat.com/prob/p100369

CommonTwo的更多相关文章

随机推荐

  1. 关于 no device found for connection ‘ System eth0′问题

    在Vmware上面安装CentOS,开机后,使用:service network restart时,会提示一下错误: Shutting down loopback interface:         ...

  2. 笨办法学Python(八)

    习题 8: 打印,打印 formatter = "%r %r %r %r" print formatter % (1, 2, 3, 4) print formatter % (&q ...

  3. python 网址

    https://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000/001431752945034e ...

  4. node执行环境

    nodejs本质上是一个javascript的执行环境,只是由于他的封装,加上更多web底层的一个处理,赋予了更多的能力,那么执行环境到底是什么呢,我们到浏览器里面体验看看,在chrome里面控制台, ...

  5. Spring boot 自动配置自定义配置文件

    示例如下: 1.   新建 Maven 项目 properties 2.   pom.xml <project xmlns="http://maven.apache.org/POM/4 ...

  6. bootstrap中模态框、模态框的属性

    工作中有需要用到模态框的可以看看 <div class="modal fade" id="userModal" tabindex="-1&quo ...

  7. 服务器缺少vcruntime140.dll,无法运行

    Redis用了一段时间,有的时候,调试的时候,RedisDesktop是个不错的工具 当我想在服务器上安装的时候,才发现服务器64位的环境里面运行出错了 百度上有共享dll出来的,但是基本都没法用,虽 ...

  8. php - empty() is_null() isset()的区别

    empty():当变量存在,并且是一个非空非零的值时,返回 FALSE,否则返回 TRUE. is_null():如果指定变量为 NULL,则返回 TRUE,否则返回 FALSE. isset():如 ...

  9. TCP/IP协议之http和https协议

    一.TCP/IP协议 TCP/IP 是不同的通信协议的大集合. 1.TCP - 传输控制协议 TCP 用于从应用程序到网络的数据传输控制. TCP 负责在数据传送之前将它们分割为 IP 包,然后在它们 ...

  10. bin/postconf: error while loading shared libraries: libmysqlclient

    今天在编译安装postfix的时候 make install 出现如下错误 bin/postconf: error while loading shared libraries: libmysqlcl ...