Uber Interview (Concurrency): Design a Class to measure ongoing requests per client
926
Mar 19, 2025
I was asked to design a class to measure ongoing requests per clientId
was provided an interface with these 3 methods:
- processRequest(reqId, clientId)
- processResponse(reqId, clientId)
- 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).
ConcurrentHashMap<String, Long> map; // <clientId, long>I still got a reject. Is there anything im missing?
Comments (3)


