Simple Sorting Solution
Approach\n\n1. Identifying Vowels: Use a Set to store all vowels (both lowercase and uppercase) for quick lookup.\n2. Separating and Sorting Vowels: Convert the
# Approach\n\n1. **Identifying Vowels**: Use a `Set` to store all vowels (both lowercase and uppercase) for quick lookup.\n2. **Separating and Sorting Vowels**: Convert the string into an array and filter out the vowels. Sort these vowels by their ASCII values.\n3. **Reconstructing the String**: Iterate through the original string. If the current character is a vowel, insert the next sorted vowel from our collection. If it\'s a consonant, keep it as is.\n\n# Complexity\n- Time complexity: $O(n \\log n)$ (Beats 91.67%)\n\n- Space complexity: $O(n)$ (Beats 87.50%)\n\n# Code\n```\nfunction sortVowels(s: string): string {\n  const vowels = new Set([\'a\', \'e\', \'i\', \'o\', \'u\', \'A\', \'E\', \'I\', \'O\', \'U\']);\n  const sArr = s.split(\'\');\n  const sortedVowel = sArr.filter((c) => vowels.has(c)).sort();\n\n  let result = \'\';\n  let vowelIndex = 0;\n  for (let i = 0; i < s.length; i++) {\n    if (vowels.has(s[i])) {\n      result += sortedVowel[vowelIndex++];\n    } else {\n      result += s[i];\n    }\n  }\n\n  return result;\n}\n```
['TypeScript', 'JavaScript']