class Solution: def reorderLogFiles(self, logs: List[str]) -> List[str]: try: dig_list = [] letter_list = [] for i in range(len(logs)): each_ele_lst = logs[i].split() if each_ele_lst[1].isdigit(): dig_list.append(logs[i]) else: letter_list.append(logs[i]) letter_list.sort(key = (lambda x: (x.split()[1:], x.split()[0]))) return letter_list+dig_list except Exception as e: print(e)
It’s useful content.
Content are pretty much precise.