Microsoft | Implement tail -f command (Print last n lines of the file)

Anonymous User
82
Apr 03, 2024
Apr 03, 2024

Hello everyone!

I was recently asked this question during an interview:

Implement a function that prints out last n lines of the file without reading the whole file. (similar to what tail -f does)

Can someone here provide some optimized approach or solution to the problem?

Thanks!

MSFT SDE2 - Phone screen - US

Comments (2)