A recruiter contacted me via LinkedIn and sent an online assessment link the same day, with a 2-day completion deadline. The assessment consisted of a 30-minute test with two easy coding questions and 15 multiple-choice questions.
Two interview rounds were scheduled for the same day. The first round involved an implementation question related to graphs. I used Breadth-First Search (BFS) to solve it. The second round focused on data structures. The question was: Given input logs with ("country","state","region",count), write APIs to store them and retrieve the count.
Sample Input: ("USA", "California", "Los Angeles", 100); ("USA", "California", "San Francisco", 50); ("country", "state", "region", 75); If retrieving the count for USA, California, the result should be 100+50.
What would be the optimal data structure to use here?
I was rejected in the second round because I could not come up with an optimal solution.