Uber Interview (Concurrency): Design a Class to measure ongoing requests per client

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2025-03-19Added By Anonymous
Source: Link

Company: Uber

Role: software engineer ii, senior software engineer

Interview Stage: Phone Screen


Original Post Content:


I was asked to design a class to measure ongoing requests per clientId.


I was provided an interface with these 3 methods:

1.processRequest(reqId, clientId)
2.processResponse(reqId, clientId)
3.getOngoingRequests(clientId)


I used a ConcurrentHashMap and made sure that all updates are inside the compute method (which I believe takes care of locking/atomicity).

The structure I used was: ConcurrentHashMap<String, Long> map; // <clientId, long>


I still got a reject. Is there anything I'm missing?

Comments