PythonBests 99% O(1) Space and O(NLogN) Time - Readable with comments
\n\nclass Solution:\n    def reorderLogFiles(self, logs: List[str]) -> List[str]:\n        return logs.sort(key= lambda log: self.customSort(log))\n        \n  
\n```\nclass Solution:\n    def reorderLogFiles(self, logs: List[str]) -> List[str]:\n        return logs.sort(key= lambda log: self.customSort(log))\n        \n    def customSort(self, log: str) -> tuple:\n\t\t#seperate identifer and suffix into two seperate arrays\n        log_info = log.split(" ", 1)\n\t\t#check if log is a letter or digital log by checking index in suffix array\n\t\t# we return 1 as tuple so that digits will always appear after letters and so that when to digits are compared\n\t\t# we can leave them in their original position\n        if log_info[1][0].isdigit():\n            return 1,\n\t\t#We use a zero to make sure that when compared against a digit we can guranatee that our letter will appear first\n\t\t#We use the suffix as the next condition and the identifier as the last condition if theres a tie\n        return 0,log_info[1],log_info[0]\n```
['Python', 'Python3']