Round 1: Online Round
The online round was conducted on hackerearth it was a 2 hour coding test consisting of 3 questions
100 points: Design a reverse proxy for the given scenario. You will be given n servers and their IP addresses, m endpoints the reverse proxy has a list of IPs for each endpoints. Every request that comes to an endpoint goes in round robin fashion to this IP address.You also get special type of hits to the reverse proxy from the server monitor which says that
a particular server has gone down and can’t take any request
a particular server is up now and can’t take any request
Once a server comes back up it should be added to end of the queue in round robin corresponding to each of endpoints it is responsible for.
At the end of q queries give out list of requests received by each servers.
50 points: Given an array of numbers return 1 is the array is spirally sorted or 0 in case it is not spirally sorted. For an array to be spirally sorted its values must be in ascending order when arranged in following order 0, n-1, 1, n-2, 2, n-3……
50 points: Given a list of words return 1 and 0 for each word depending on whether they have at max n repetition of a single character in them
Round 2: Machine Coding Round
This problem requires you to implement a log watching solution (similar to the tail -f command in UNIX). However, in this case, the log file is hosted on a remote machine (same machine as your server code). The log file is in append-only mode.
You have to implement the following:
1. A server side program to monitor the given log file and capable of streaming updates that happen in it. This will run on the same machine as the log file. You may implement the server in any programming language.
2. A web based client (accessible via URL like http://localhost/log) that prints the updates in the file as and when they happen and NOT upon page refresh. The page should be loaded once and it should keep getting updated in real-time. The user sees the last 10 lines in the file when he lands on the page.
Problem Constraints
The server should push updates to the clients as we have to be as real time as possible.
Be aware that the log file may be several GB, how to optimise for retrieving the last 10 lines?
The server should not retransmit the entire file every time. It should only send the updates.
The server should be able to handle multiple clients at the same time.
The web page should not stay in loading state post the first load and it should not reload thereafter as well.
You may not use off-the-shelf external libraries or tools to read the file or provide tail-like functionalities.
We will be evaluating you for code quality, testability, modularity, corner cases, etc.
I didn't get selected for the last round.