cs: add «1400. Construct K Palindrome Strings»

Count directly elements matching the parity check, do not prefilter and
count what's been included.

URL:	https://leetcode.com/problems/construct-k-palindrome-strings/
Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
Matej Focko 2025-01-11 19:13:49 +01:00
parent 907856146c
commit 80974c503d
Signed by: mfocko
SSH key fingerprint: SHA256:icm0fIOSJUpy5+1x23sfr+hLtF9UhY8VpMC7H4WFJP8

View file

@ -11,6 +11,6 @@ public class Solution {
parities[c - 'a'] ^= 1;
}
return parities.Where(p => p != 0).Count() <= k;
return parities.Count(p => p != 0) <= k;
}
}