Tail-like: Print Last N Lines of a File (Streaming)

Asked at Confluent · Coding Questions · Difficulty: Hard · Last asked Jul 15, 2026

Given a very large text file (lines separated by `\n`), implement a function that outputs the **last `N` lines** to `stdout`.

Loading the problem…