Easiest way to solve (TC 100%) (SC 85%)
Intuition\nCount Frequencies: The code counts how many times each character appears in the input string.\nBuild Result: It alternates between adding characters 
# Intuition\nCount Frequencies: The code counts how many times each character appears in the input string.\nBuild Result: It alternates between adding characters in increasing and then decreasing alphabetical order until all characters are used.\nReturn: The final result is a string where characters are added in a sorted, alternating pattern.\n\n# Approach\nclass Solution {\n    public String sortString(String s) {\n        int[] count = new int[26];  // Array to store the frequency of each character\n        int length = s.length();    // Length of the input string\n\n        // Count the frequency of each character\n        for(int i = 0; i < length; ++i) {\n            count[s.charAt(i) - \'a\']++;\n        }\n\n        StringBuilder sb = new StringBuilder();  // StringBuilder to build the result string\n        \n        // Build the result string\n        while(sb.length() < length) {\n            // Append characters in increasing lexicographical order\n            for(int i = 0; i < 26; ++i) {\n                if (count[i] > 0) {\n                    sb.append((char) (\'a\' + i));\n                    count[i]--;\n                }\n            }\n            // Append characters in decreasing lexicographical order\n            for(int i = 25; i >= 0; --i) {\n                if (count[i] > 0) {\n                    sb.append((char) (\'a\' + i));\n                    count[i]--;\n                }\n            }\n        }\n        \n        return sb.toString();  // Convert StringBuilder to String and return\n    }\n}\n\n\n# Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(1)\n\n# Code\n```java []\nclass Solution {\n    public String sortString(String s) {\n        int [] count = new int [26];\n        int n = s.length();\n\n        for(int i=0; i<n; ++i){\n            count[s.charAt(i) - \'a\']++;\n        }\n\n        StringBuilder sb = new StringBuilder();\n        while(sb.length()<n){\n            for(int i=0; i<26; ++i){\n                if (count[i] > 0) {\n                    sb.append((char) (\'a\' + i));\n                    --count[i];\n                }\n            }\n            for(int i=25; i>=0; --i){\n                if (count[i] > 0) {\n                    sb.append((char) (\'a\' + i));\n                    --count[i];\n                }\n        }\n        \n    }\n    return sb.toString();\n    }\n}\n\n```
['Hash Table', 'String', 'Java']