You are given an array of strings logs. Each log is a space delimited string of words, where the first word is an alphanumeric identifier.
There are two categories of logs:
Letter logs: All words after the identifier consist exclusively of lowercase English letters.
Digit logs: All words after the identifier consist exclusively of digits.
Reorder the logs according to the following rules:
All letter logs must appear before any digit logs.
Letter logs are sorted lexicographically primarily by their contents. If two letter logs have identical contents, sort them lexicographically by their identifiers.
Digit logs must preserve their original relative order.
Return the array of logs after applying the reordering.
Constraints:
logs.length
logs[i].length
All the tokens of logs[i] are separated by a single space.
logs[i] is guaranteed to have an identifier and at least
You are given an array of strings logs. Each log is a space delimited string of words, where the first word is an alphanumeric identifier.
There are two categories of logs:
Letter logs: All words after the identifier consist exclusively of lowercase English letters.
Digit logs: All words after the identifier consist exclusively of digits.
Reorder the logs according to the following rules:
All letter logs must appear before any digit logs.
Letter logs are sorted lexicographically primarily by their contents. If two letter logs have identical contents, sort them lexicographically by their identifiers.
Digit logs must preserve their original relative order.
Return the array of logs after applying the reordering.
Constraints:
logs.length
logs[i].length
All the tokens of logs[i] are separated by a single space.
logs[i] is guaranteed to have an identifier and at least