Solutions to LeetCode 937 Reorder Data in Log Files
LeetCode 937
Reorder Data in Log Files (Medium) [link]
class Solution:
def reorderLogFiles(self, logs: List[str]) -> List[str]:
def trans(log: str) -> tuple:
a, b = log.split(' ', 1)
return (0, b, a) if b[0].isalpha() else (1,)
logs.sort(key=trans)
return logs