Simple and easy to understand java solution | Clean code | PriorityQueue
Intuition\n Describe your first thoughts on how to solve this problem. \nKeep track of vowels in min heap, and create result using pq elements\n\n# Complexity\n
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nKeep track of vowels in min heap, and create result using pq elements\n\n# Complexity\n- Time complexity: O(N)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(V) i.e no. of vowels in string\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public String sortVowels(String s) {\n        Set<Character> vowels = Set.of(\'A\', \'E\', \'I\', \'O\',\'U\',\'a\',\'e\',\'i\',\'o\',\'u\');\n        PriorityQueue<Character> pq = new PriorityQueue<>();\n\n        for(char c: s.toCharArray()){\n            if(vowels.contains(c)){\n                pq.add(c);\n            }\n        }\n\n        StringBuilder sb = new StringBuilder();\n        for(char c: s.toCharArray()){\n            if(vowels.contains(c)){\n                sb.append(pq.poll());\n            } else {\n                sb.append(c);\n            }\n        }\n        return sb.toString();\n    }\n}\n```
['String', 'Sorting', 'Heap (Priority Queue)', 'Java']