[Python 3] Using Set and Sort with commentary
\nclass Solution:\n    def sortString(self, s: str) -> str:\n        s = list(s)\n        # Big S: O(n)\n        result = []\n        \n        # Logic is captu
```\nclass Solution:\n    def sortString(self, s: str) -> str:\n        s = list(s)\n        # Big S: O(n)\n        result = []\n        \n        # Logic is capture distinct char with set\n        # Remove found char from initial string\n        \n        # Big O: O(n)\n        while len(s) > 0:\n\n            # Big O: O(n log n) Space: O(n)\n            smallest = sorted(set(s))\n            # Big O: O(s) - reduced set\n            for small in smallest:\n                result.append(small)\n                s.remove(small)\n                \n            # Big O: O(n log n) Space: O(n)\n            largest = sorted(set(s), reverse = True)\n            # Big O: O(s) - reduced set\n            for large in largest:\n                result.append(large)\n                s.remove(large)\n        \n        return \'\'.join(result)\n    \n        # Summary:  Big O(n)^2 Space: O(n)\n```
['Sorting', 'Ordered Set', 'Python', 'Python3']