// For a balanced substring with one char, any length works (all chars are equal) maxlen = Math.max(maxlen, getLength(s, 'a')); // Consider 'b' and 'c' maxlen = Math ...
第二个方法,是Code Granker上面的,利用了高中学排列组合时候的概念。 有个‘abc’,那么总共可以看成'a_b_c' 5个字符位置 ...