Hey everyone sharing my recent experience with uber for SDE-2 role.
Online Screening
Two questions to be solved in 90 min:
Round1
Domain specialization / machine coding:
Implement an InMemory Task scheduler Library that supports these functionalities:
Submit a task and a time at which the task should be executed. --> schedule(task, time)
Schedule a task at a fixed interval --> scheduleAtFixedInterval(task, interval) - interval is in seconds
They expected a runnable code (wasn't able to complete it)
Round2
DS/Problem Solving
Need to provide three methods count(key,t), getCount(key,t), getAllCount(t). count method is basically is used to increment the counter of the key. getCount is used to fetch the count of the key at time t and getAllCount is used to tell the count of all the keys at time t. We need to maintain the counter for each key for a fixed timeFrame T e.g. 10 seconds.
Solved this with the help of queue. Did some mistakes while coding.
Follow up was how would you safeguard all the three methods in case of multithreaded enviornment.
P.S - It's been 1.5 days and I haven't head back from the recruiter, assuming it's a reject.