Uber | L4 | India | Reject

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2022-08-25Added By Anonymous
Source: Link

Company: Uber

Role: software engineer ii

Interview Stage: Phone Screen

Location: India


Original Post Content:


The recruiter reached out to me through LinkedIn.

YEO: 5


Both rounds were coding rounds scheduled over Zoom


1st Round

The interviewer was extremely friendly. He asked me to calm myself down, and can go grab coffee/tea if I want. Only one question was asked. Interviewer told me that he is not expecting answer or most optimized answer, but will look at my approach. I missed optimization part of not putting cell in grid if we have reached it with bigger value of K.

shortest-path-in-a-grid-with-obstacles-elimination


2nd Round

Given continuous input stream of data


User City Event Timestamp

user1 Blgr RIDE_REQUESTED timestamp1

user2 Blgr RIDE_REQUESTED timestamp3

user1 Blgr RIDE_CANCELLED timestamp2

user1 Blgr COMPLETED timestamp4


The input stream is not ordered based on timestamp, as in an event occurring later can come first. You have to put this in a data structure to support timestamp based queries, like Give list of RIDE_REQUESTED for bglr city from [timestamp1,.. timestamp5]


Solutions discussed:

1.I suggested to use ordered map, but the interviewer said that data is too much, and insertion in ordered map will take logn which is not feasible
2.Next i suggested to use unordered map and use a for loop to run on timestamps. He rejected this saying, if range asked is 1 to 1000 timestamp and there are very few entries for this timestamp, than your for loop will be inefficient
3.After this I discussed B+ Tree, segment tree, using Array's index and doing binary search over it.
4.In end he asked me to implement Segment tree, which i was not confident of from implementation perspective, so implemented unordered_map solution.


Throughout interview, the interviewer kept suggesting me to use basic data structures and think what STL library actually use to implement Map. I really enjoyed this round cause of the discussion that happened and how good the interviewer was quickly grasping whatever solution I was suggesting.

Comments