Amazon SDE-2 R1
Company: Amazon
Role: SDE II
Interview Stage: Phone Screen
Location: unknown
Year: unknown
Original Post Content:
A Fulfillment Center: you have multiple input conveyer belts; on those belts, there are packages flowing in sorted order. A picker needs to work on those orders from those input belts and put them on an output belt, keeping the packages sorted in a new conveyer belt.
Example:
conveyer belt A: 1, 3, 7
conveyer belt B: 1, 2, 5, 7, 11, 20
conveyer belt C: 0, 4
output: 0, 1, 1, 2, 3, 4, 5, 7, 7, 11, 20
N = number of conveyer belt
M = number of packages in each conveyer belt
M >> N
O(M1+M2)
O(N*m logNM)
Let's say we are working on a shopping website and we want to analyze non returning users to offer them some promotions to get their attention again.
We know that every user has their unique usernames, so we can track whether they are visiting the website again or not.
For this task we need to implement below methods.
newUserLogin(username): This method will be called every time a user logs in
getOldestOneTimeVisitingUser(): This method will return the username of the oldest customer who has visited the website only once.
Example:
newUserLogin(john);
newUserLogin(jeff);
newUserLogin(jeff);
getOldestOneTimeVisitingUser(); should return john
newUserLogin(chriss);
newUserLogin(john);
newUserLogin(adam);
newUserLogin(sandy);
getOldestOneTimeVisitingUser(); should return chriss