Python Elegant & Short | Stack
Complexity\n- Time complexity: O(n + m * \log_{2} m), where m - vowels count\n- Space complexity: O(n)\n\n# Code\n\nclass Solution:\n    VOWELS = frozenset(\'ae
# Complexity\n- Time complexity: $$O(n + m * \\log_{2} m)$$, where m - vowels count\n- Space complexity: $$O(n)$$\n\n# Code\n```\nclass Solution:\n    VOWELS = frozenset(\'aeiouAEIOU\')\n\n    def sortVowels(self, s: str) -> str:\n        vowels = sorted((c for c in s if c in self.VOWELS), reverse=True)\n        return \'\'.join(c if c not in self.VOWELS else vowels.pop() for c in s)\n```\n
['Stack', 'Python', 'Python3']