LeetCode --- 937. Reorder Data in Log Files 解题报告
Posted 杨鑫newlfe
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了LeetCode --- 937. Reorder Data in Log Files 解题报告相关的知识,希望对你有一定的参考价值。
You are given an array of logs
. Each log is a space-delimited string of words, where the first word is the identifier.
There are two types of logs:
- Letter-logs: All words (except the identifier) consist of lowercase English letters.
- Digit-logs: All words (except the identifier) consist of digits.
Reorder these logs so that:
- The letter-logs come before all digit-logs.
- The letter-logs are sorted lexicographically by their contents. If their contents are the same, then sort them lexicographically by their identifiers.
- The digit-logs maintain their relative ordering.
Return the final order of the logs.
Example 1:
Input: logs = ["dig1 8 1 5 1","let1 art can","dig2 3
以上是关于LeetCode --- 937. Reorder Data in Log Files 解题报告的主要内容,如果未能解决你的问题,请参考以下文章
[LeetCode] 937. Reorder Data in Log Files
[LeetCode] 937. Reorder Data in Log Files
[Leetcode]937. Reorder Log Files给日志文件排序
LeetCode --- 937. Reorder Data in Log Files 解题报告