Skip to content

Latest commit

 

History

History
17 lines (16 loc) · 319 Bytes

1446. 连续字符.md

File metadata and controls

17 lines (16 loc) · 319 Bytes
class Solution {
    public int maxPower(String s) {
        char[] cs = s.toCharArray();
        char t = cs[0];
        int v = 0, z = 0;
        for (char c : cs) {
            if (c == t) v++;
            else v = 1;
            t = c;
            if (v > z) z = v;
        }
        return z;
    }
}