Define a Sorting Algorithm and Then Use It to Sort!!!
It is a good question but should not be an easy question!\n\nDefine an sorting algorithm, then sort the logs list using this function.\n\nTime: O(nlgn * m), n i
It is a good question but **should not be an easy** question!\n\n**Define** an **sorting algorithm**, then sort the logs list using this function.\n\n**Time:** O(nlgn * m), n is the length of the logs list, m is the average length of words.\n**Space:** O(n * m)\n\n```\nclass Solution:\n    def reorderLogFiles(self, logs: List[str]) -> List[str]:\n        \n        def sorting_algorithm(log):\n            left_id, right_resting = log.split(" ", 1)\n\n            if right_resting[0].isalpha():\n                return (0, right_resting, left_id)\n            else:\n                return (1, None, None)\n\n        return sorted(logs, key=sorting_algorithm)\n```
['Sorting', 'Python']