diff --git a/2025-01-January-LeetCoding-Challenge/Minimum Length of String After Operations.py b/2025-01-January-LeetCoding-Challenge/Minimum Length of String After Operations.py new file mode 100644 index 0000000..249bd19 --- /dev/null +++ b/2025-01-January-LeetCoding-Challenge/Minimum Length of String After Operations.py @@ -0,0 +1,18 @@ +from collections import Counter + + +class Solution: + def minimumLength(self, s: str) -> int: + return sum(1 if c & 1 else 2 for c in Counter(s).values()) + + +def main(): + s = 'abaacbcbb' + assert Solution().minimumLength(s) == 5 + + s = 'aa' + assert Solution().minimumLength(s) == 2 + + +if __name__ == '__main__': + main() diff --git a/2025-01-January-LeetCoding-Challenge/README.md b/2025-01-January-LeetCoding-Challenge/README.md index 6814999..9db686e 100644 --- a/2025-01-January-LeetCoding-Challenge/README.md +++ b/2025-01-January-LeetCoding-Challenge/README.md @@ -15,7 +15,7 @@ | January 10 | [916. Word Subsets](https://leetcode.com/problems/word-subsets/) | Medium | Solved | | January 11 | [1400. Construct K Palindrome Strings](https://leetcode.com/problems/construct-k-palindrome-strings/) | Medium | Solved | | January 12 | []() | | | -| January 13 | []() | | | +| January 13 | [3223. Minimum Length of String After Operations](https://leetcode.com/problems/minimum-length-of-string-after-operations/) | Medium | Solved | | January 14 | []() | | | | January 15 | []() | | | | January 16 | []() | | | @@ -40,5 +40,5 @@ | Level | Problems | Solved | Unsolved | | --- | --- | --- | --- | | Easy | 4 | 4 | 0 | -| Medium | 7 | 7 | 0 | +| Medium | 8 | 8 | 0 | | Hard | 0 | 0 | 0 |