🔥✔Very Easy Solution||Java
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public String sortString(String s) {\n        int[] freq = new int[26];\n        String ans = "";\n        for(int i = 0; i < s.length(); i++){\n            int ch = s.charAt(i) - \'a\';\n            freq[ch]++;\n        }\n        while(ans.length() != s.length()){  \n        for(int i = 0; i < freq.length; i++){\n            if(freq[i] > 0){\n               \tchar c =(char) (i + \'a\');\n                ans+= c;\n                freq[i]--;\n            }\n        }\n        for(int i = freq.length -1; i >= 0; i--){\n            if(freq[i] > 0){\n                char c =(char) (i + \'a\');\n                ans+= c;\n                freq[i]--;\n            }\n        }\n     }\n        return ans;\n    }\n}\n```
['Java']