leetcode-5326-构造k个回文字符串

题目描述:

 统计字符奇偶次数即可

class Solution:
    def canConstruct(self, s: str, k: int) -> bool:
        if k > len(s):
            return False
        c = collections.Counter(s)
        o = sum(i % 2 for i in c.values())
        return o <= k

猜你喜欢

转载自www.cnblogs.com/oldby/p/12636115.html
今日推荐