Java Solution 💚💚 | Easy Solution
Complexity\n- Time complexity:\nO(n*log(n))\n- Space complexity:\nO(n)\n\n# Code\n\nclass Solution {\n    public String sortVowels(String s) {\n        ArrayLis
# Complexity\n- Time complexity:\nO(n*log(n))\n- Space complexity:\nO(n)\n\n# Code\n```\nclass Solution {\n    public String sortVowels(String s) {\n        ArrayList<Character> list = new ArrayList<>();\n        HashSet<Character> hs = new HashSet();\n\n        hs.add(\'a\');\n        hs.add(\'e\');\n        hs.add(\'i\');\n        hs.add(\'o\');\n        hs.add(\'u\');\n        hs.add(\'A\');\n        hs.add(\'E\');\n        hs.add(\'I\');\n        hs.add(\'O\');\n        hs.add(\'U\');\n        \n        for(int i = 0; i < s.length(); i++)\n            if(hs.contains(s.charAt(i)))\n                list.add(s.charAt(i));\n\n        Collections.sort(list);\n\n        int k = 0;\n        StringBuilder str = new StringBuilder("");\n\n        for(int i = 0; i < s.length(); i++)\n            if(hs.contains(s.charAt(i))){\n                str.append(list.get(k));\n                k++;\n            }\n            else\n                str.append(s.charAt(i));\n  \n        return str.toString();\n    }\n}\n// UP-VOTE IF HELPFUL\n```
['Hash Table', 'String', 'Sorting', 'Java']