Interview 1
Your goal is to parse a log file and do some analysis on it. The log file contains all requests to a server within a specific timeframe.
You are given the following method/url definitions:
GET /api/users/{user_id}/count_pending_messages
GET /api/users/{user_id}/get_messages
GET /api/users/{user_id}/get_friends_progress
GET /api/users/{user_id}/get_friends_score
POST /api/users/{user_id}
GET /api/users/{user_id}
Where user_id is the id of the user calling the backend.
The script/program should output a small analysis of the sample. It should contain the following information for each of the URLs above:
The number of times the URL was called.
Mean (average) response times (connect time + service time)
Median response times (connect time + service time)
The output should be a JSON string.
The log format is defined as:
{timestamp} {source}[{process}]: at={log_level} method={http_method} path={http_path} host={http_host} fwd={client_ip} dyno={responding_dyno} connect={connection_time}ms service={processing_time}ms status={http_status} bytes={bytes_sent}Example:
2014-01-09T06:16:53.916977+00:00 heroku[router]: at=info method=GET path=/api/users/1538823671/count_pending_messages host=mygame.heroku.com fwd="208.54.86.162" dyno=web.11 connect=7ms service=9ms status=200 bytes=33
2014-01-09T06:18:53.014475+00:00 heroku[router]: at=info method=GET path=/api/users/78475839/count_pending_messages host=mygame.heroku.com fwd="208.54.86.162" dyno=web.10 connect=8ms service=10ms status=200 bytes=33
2014-01-09T06:20:33.142889+00:00 heroku[router]: at=info method=GET path=/api/users/847383/count_pending_messages host=mygame.heroku.com fwd="208.54.86.162" dyno=web.10 connect=7ms service=10ms status=200 bytes=33Given the above three log lines, we would expect output like:
{
"request_identifier": "GET /api/users/{user_id}/count_pending_messages",
"called": 3,
"response_time_mean": 17.0,
"response_time_median": 17.0,
}Sample logs can be found at https://gist.githubusercontent.com/bss/6dbc7d4d6d2860c7ecded3d21098076a/raw/244045d24337e342e35b85ec1924bca8425fce2e/sample.small.log
Interview 2
We have a product problem to solve that requires us to implement a custom data store for key-value pairs
First, implement a Key-Value store with simple add, get, and delete functions.
We now want to add some advanced functionality to our key value store: keeping track of historical values. Modify the Key-Value Store to keep track of previous values for a given key. Specifically, we want to implement a function get_at_effective_date that takes a key and a specific time, and returns the value for the key at the specified point in time. Here is an example:
// At 7:00 AM, we initialize the key value store
kvs = new KeyValueStore()
// At 7:30 AM, we add an entry for the key 'a'
kvs.add('a', 10)
// At 8:00 AM, we update the entry for the key 'a'
kvs.add('a', 20)
// At 8:30 AM, we ask for the current value of the key 'a'
kvs.get('a') // returns 20
// At 8:35 AM, we ask what the value was for the key 'a' at 7:35 AM
kvs.get_at_effective_date('a', DateTime.parse('7:35 AM')) // returns 10Interview 3: Pair programming
Gusto’s payroll system allows employers to enter some basic information about employees being paid (like how much they should get paid) and then submit the payroll for processing. The payroll system does a lot of the work at this point and calculates the taxes to withhold for an employee, the taxes due by the employee, etc.
IRS withholding (federal income tax) is one of these taxes. The IRS uses a concept of federal income tax brackets to determine the amount of money to withhold from employees.
https://www.nerdwallet.com/assets/blog/wp-content/uploads/2022/10/Example2_TY2022.png
Q: Create a software library that will know how to calculate federal income taxes.
Interview 4: System design
Design a social polling app. User should be create polls and vote for option, etc.


