
Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.
History is littered with hundreds of conflicts over the future of a community, group, location or business that were "resolved" when one of the parties stepped ahead and destroyed what was there. With the original point of contention destroyed, the debates would fall to the wayside. Archive Team believes that by duplicated condemned data, the conversation and debate can continue, as well as the richness and insight gained by keeping the materials. Our projects have ranged in size from a single volunteer downloading the data to a small-but-critical site, to over 100 volunteers stepping forward to acquire terabytes of user-created data to save for future generations.
The main site for Archive Team is at archiveteam.org and contains up to the date information on various projects, manifestos, plans and walkthroughs.
This collection contains the output of many Archive Team projects, both ongoing and completed. Thanks to the generous providing of disk space by the Internet Archive, multi-terabyte datasets can be made available, as well as in use by the Wayback Machine, providing a path back to lost websites and work.
Our collection has grown to the point of having sub-collections for the type of data we acquire. If you are seeking to browse the contents of these collections, the Wayback Machine is the best first stop. Otherwise, you are free to dig into the stacks to see what you may find.
The Archive Team Panic Downloads are full pulldowns of currently extant websites, meant to serve as emergency backups for needed sites that are in danger of closing, or which will be missed dearly if suddenly lost due to hard drive crashes or server failures.
You have an array of
logs
. Each log is a space delimited string of words.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:
Constraints:
0 <= logs.length <= 100
3 <= logs[i].length <= 100
logs[i]
is guaranteed to have an identifier, and a word after the identifier.这道题让给日志排序,每条日志是由空格隔开的一些字符串,第一个字符串是标识符,可能由字母和数字组成,后面的是日志的内容,只有两种形式的,要么都是数字的,要么都是字母的。排序的规则是对于内容是字母的日志,按照字母顺序进行排序,假如内容相同,则按照标识符的字母顺序排。而对于内容的是数字的日志,放到最后面,且其顺序相对于原顺序保持不变。博主感觉这道题似曾相识啊,貌似之前在很多 OA 中见过,最后还是被 LeetCode 收入囊中了。其实这道题就是个比较复杂的排序的问题,两种日志需要分开处理,对于数字日志,不需要排序,但要记录其原始顺序。这里就可以用一个数组专门来保存数字日志,这样最后加到结果 res 后面,就可以保持其原来顺序。关键是要对字母型日志进行排序,同时还要把标识符提取出来,这样在遍历日志的时候,先找到第一空格的位置,这样前面的部分就是标识符了,后面的内容就是日志内容了,此时判断紧跟空格位置的字符,假如是数字的话,说明当前日志是数字型的,加入数组 digitLogs 中,并继续循环。如果不是的话,将两部分分开,存入到一个二维数组 data 中。之后要对 data 数组进行排序,并需要重写排序规则,要根据日志内容排序,若日志内容相等,则根据标识符排序。最后把排序好的日志按顺序合并,存入结果 res 中,最后别忘了把数字型日志也加入 res, 参见代码如下:
参考资料:
https://leetcode.com/problems/reorder-data-in-log-files/
https://leetcode.com/problems/reorder-data-in-log-files/discuss/192438/C%2B%2B-O(NlogN)-Time-O(N)-Space
https://leetcode.com/problems/reorder-data-in-log-files/discuss/193656/C%2B%2B-stable_sort-easy-to-understand
https://leetcode.com/problems/reorder-data-in-log-files/discuss/193872/Java-Nothing-Fancy-15-lines-2ms-all-clear.
LeetCode All in One 题目讲解汇总(持续更新中...)
The text was updated successfully, but these errors were encountered: