C#两道面试题,求好算法

日期:2011-08-04 10:51:58 人气:1

C#两道面试题,求好算法

string str="abbcccdd"; int i=str.Length; char ch=str[0]; int num=1; int best=1; for(int j=1;j<i;j++) { if(str[j]==ch) num++; else { ch=str[j]; num=1; if(num>best) best=num; } } 基本就是这样。 第一个还是一位一位读,做一个int i=0; 读到{ i+1,判断
    A+
热门评论