Skip to content
LC-2716 Easy LeetCode

2716. Minimize String Length

Read the full problem statement on LeetCode.
Difficulty: easy Acceptance: 77% Topics: Hash Table, String
View full problem on LeetCode
Reference solution (spoiler · python)
# Time:  O(n)
# Space: O(1)

# hash table
class Solution(object):
    def minimizedStringLength(self, s):
        """
        :type s: str
        :rtype: int
        """
        return len(set(s))

Solution from kamyu104/LeetCode-Solutions · MIT