Simple Solution💯
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```\n/**String.fromCharCode(pos+97)\n * @param {string} s\n * @return {string}\n */\nvar sortString = function(s) {\n    memo=new Array(26).fill(0)\n    str=[]\n    for(let i=0;i<s.length;i++){\n        memo[s.charCodeAt(i)-97]++\n    }\n    let flag=true\n    while(str.length!==s.length){\n        \n        for(let i=0;i<memo.length;i++){\n            let pos=i\n            \n            if(!flag){\n                pos=25-i\n            }\n            if(memo[pos]!== 0){\n            str.push(String.fromCharCode(pos+97))\n            memo[pos]--\n            }\n        }\n        flag = ! flag\n    }\n  \n  return str.join(\'\')\n};\n```
['JavaScript']