uber | Software Engineer | Interview Experience
Interview Date: Not specified
Result: Not specified
Difficulty: Not specified
Interview Process
The interview was conducted online and focused on a technical assessment. The candidate was asked to design a Counter class that manages elements with expiration times.
Technical Questions
-
Counter Class (Hash Table, Design)
Write a Counter class where each element has an expiration time provided during initialization. Implement the following functions:put(element): Adds an element to the Counter.get_count(element): Returns the current valid count of the specified element in the Counter.get_total_count(): Returns the total count of all valid elements in the Counter.
Example Usage:
counter(window=10) time 1: counter.put('a') time 3: counter.put('a') time 5: counter.put('b') time 6: counter.get_count('a') -> 2 time 6: counter.get_total_count() -> 3 time 12: counter.get_count('a') -> 1 time 12: counter.get_total_count() -> 2
Tips & Insights
Focus on understanding data structures and their applications, particularly in managing time-sensitive data.