Queues : Print last N lines of a file After going through many interview experiences at Microsoft on geeksforgeeks.org , I found that one question regularly features in majority of interviews, so I decided to solve it and write a post on it. Problem statement Given a log, file print last N lines of that file. Analysis There are two parts of given problem, one is related to file operations. We need to open a file, get input from the file stream till End of File and then close the stream. Second file is to maintain last N lines we have seen till now. In other words,
Read full article from Algorithms and Me: Queues : Print last N lines of a file
No comments:
Post a Comment