✅Easy To Understand || C++ || sorting acc to ascii✅
Intuition\n Describe your first thoughts on how to solve this problem. \nWe can simply store all vowels present in string s in array as integer(which is their A
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nWe can simply store all vowels present in string s in array as integer(which is their ASCII values) and sort that array.\n# Approach\n<!-- Describe your approach to solving the problem. -->\nsorting all vowels acc to acsii values in vector we can simply place the vowels in increasing order of ascii values and get the required answer string.\n# Complexity\n- Time complexity: $$O(nlogn)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(no. of vowels)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n        \n    bool isVowel(char ch)\n{\n    ch = toupper(ch);\n    return (ch==\'A\' || ch==\'E\' || ch==\'I\' ||\n                       ch==\'O\' || ch==\'U\');\n}\n    \n    string sortVowels(string s) {\n        string t = s;\n        vector<int> vowel;\n        for(int i=0;i<s.length();i++){\n            if(isVowel(s[i])) vowel.push_back((int)s[i]);\n        }\n        if(vowel.size()==0) return s;\n        sort(vowel.begin(), vowel.end());\n        int j=0;\n        for(int i=0;i<t.length();i++){\n            if(isVowel(t[i])) {t[i]=(char)vowel[j++];}\n        }\n        \n        return t;\n    }\n};\n```
['String', 'Sorting', 'C++']