CommonTwo
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
MySQL限时解答,24小时内友哥专业解答
http://www.yougemysqldba.com
如有进一步需要请联系微信onesoft007
微博账号@友哥一指
http://www.yougemysqldba.com
如有进一步需要请联系微信onesoft007
微博账号@友哥一指