Implement the Unix tail -N command: given a file, read and print the last N lines.
Unlock detailed company stats for this questionUpgrade
Follow-up optimization for a very large, continuously growing log file: read the file backwards in fixed-size chunks, counting newline characters until enough lines are found, then seek to that offset and read forward, instead of scanning from the beginning.
Expect follow-ups like
- How would you optimize for a very large, continuously growing log file?
Format · Live coding in Java; consulting JDK documentation allowed.
Community answers
No answers contributed by the community yet.
Related questions
Implement the Unix tail command.Implement countLakes to count the lakes within a given island of a grid.Related courses

Course

Course
Course
