Solve Sort Log Files using Lua to enhance your skills with lua coding practice , master coding concepts, and prepare for interviews with practical exercises and detailed solutions.
Difficulty : Easy
Categories :
Given an array of strings logs, where each log entry is of the form "id content", sort the logs with the following rules:
Input: ["dig1 8", "let1 art", "dig2 3", "let2 own"] Output: ["let1 art", "let2 own", "dig1 8", "dig2 3"] Explanation: Letter logs come first, sorted by content
Input: ["dig1 1", "let1 cat", "let2 cat"] Output: ["let1 cat", "let2 cat", "dig1 1"] Explanation: When contents tie, sort by ID
Real-World Applications Solve problems inspired by Lua's common use cases, such as game development and embedded systems.
Step-by-Step Guidance Break down Lua's concepts into digestible lessons.
Practical Skills Build hands-on experience with Lua for real-world projects.