LeetCode #1400

Construct K Palindrome Strings

1개의 풀이 · C++

문제 원문 보기 ↗

SOLUTION INFO

C++ · main.cpp

main.cpp
class Solution {
public:
    bool canConstruct(string s, int k) {
        int cnt = 0;
        for(const char &ch: s) cnt ^= 1 << (ch - 'a');
        return s.size() >= k && __builtin_popcount(cnt) <= k;
    }
};

SOLUTION DESCRIPTION

풀이 설명

등록된 풀이 설명이 없습니다.