[Leetcode]937. Reorder Log Files给日志文件排序
2020-12-13 02:06
标签:代码 space ide character 一个 dig hat bsp file You have an array of For each log, the first word in each log is an alphanumeric identifier. Then, either: We will call these two varieties of logs letter-logs and digit-logs. It is guaranteed that each log has at least one word after its identifier. Reorder the logs so that all of the letter-logs come before any digit-log. The letter-logs are ordered lexicographically ignoring identifier, with the identifier used in case of ties. The digit-logs should be put in their original order. Return the final order of the logs. Example 1: Note: 题意: 给定日志文件(规定首单词是认证号), 要求以字母日志在前,数字日志在后的顺序排序 思路: 重写一个Comparator 代码: [Leetcode]937. Reorder Log Files给日志文件排序 标签:代码 space ide character 一个 dig hat bsp file 原文地址:https://www.cnblogs.com/liuliu5151/p/11026126.htmllogs
. Each log is a space delimited string of words.
Input: ["a1 9 2 3 1","g1 act car","zo4 4 7","ab1 off key dog","a8 act zoo"]
Output: ["g1 act car","a8 act zoo","ab1 off key dog","a1 9 2 3 1","zo4 4 7"]
0
3
logs[i]
is guaranteed to have an identifier, and a word after the identifier. 1 class Solution {
2 public String[] reorderLogFiles(String[] logs) {
3 Comparator
文章标题:[Leetcode]937. Reorder Log Files给日志文件排序
文章链接:http://soscw.com/essay/24897.html