Did online assessment for Stripe recently. Applied just through their website.
Question contains of 3 parts. you need to implement everything and tests need to pass for all 3 parts. Task is not hard by itself, but it is a wall of text to read (3 screens, Carl!), understand what exactly is needed and implement it in 1 hour. There is not too much of a logic, it's more like you have to read and type really fast to be able to finish it. I didn't manage to make all tests green in time, so it is a no.
Giving back to community. I won't paste whole task description, there are 3 screens of text, which you need dig through. I'll post only essential part of the task.
You receive vector of transactions, need to ouput vector of alerts.
For each transaction you check if alert should be triggered. All evaluations user a 30-second sliding window, meaning for a log timestamp T the window includes all logs in range [T-29,T].
Alert is triggered per pair {merchantId, code}
Input contains status code, where everything except 200 is an error to count.
Output is a string in format:
timestamp,event_type,merchant_id,status_code.
Output must be sorted by (timestamp ASC, merchant_id ASC, status_code ASC, event_type ASC)
If alert was triggered and still active (has not been resolved), do not trigger a duplicate alert.
Part1:
Alerts should be triggered if there are at least 5 failures with the exact same error code fot the same merchant within the last 30 seconds:
Input:
10,merchant1,500,2
10,merchant2,500,1
15,merchant1,500,2
20,merchant1,500,1
20,merchant2,500,4
Output:
20,TRIGGER,merchant1,500
20,TRIGGER,merchant2,500Part2:
Now alert is triggered if both conditions are met:
Input:
10,merchant1,200,600
12,merchant1,500,6
15,merchant2,200,599
16,merchant2,500,6
Output:
16,TRIGGER,merchant2,500Part3:
TRIGGER conditions are the same as part1,2
Now we implement "RESOLVED":
Input:
10,merchant1,500,6
16,merchant2,500,6
45,merchant1,200,1
45,merchant2,200,1
Output:
10,TRIGGER,merchant1,500
16,TRIGGER,merchant2,500
45,RESOLVE,merchant1,500