I was contacted by HR on email saying profile has been shortlisted, and asked to share updated details.
My onsite interviews were scheduled in 3-4 days after the first interaction. Tried to reschedule it, but the HR informed they have to close all the positions on that day itself, So they are in rush.
Onsite Day:
Machine Coding round - Asked to build Food ordering system.
Problem Solving and Data Structures round - 2 questions, 1 hour
- Given a list of order status events for a single order. Count the out of order events. Order status will be a separate dictionary sequence.
* Suppose there are following statuses an order goes through in this sequence - ["PLACED", "APPROVED", "SHIPPED", "ON THE ROUTE", "OUT FOR DELIVERY", "DELIVERED"].
* Now we receive order status events list:
* [{"id" : 1, status: "PLACED"}, {"id" : 1, status: "ON THE ROUTE"}, {"id" : 1, status: "APPROVED"}, {"id" : 1, status: "SHIPPED"}] == So here we see, there are 3 statuses which were out of order which is our answer.
- You are a bookseller who wants to sell books on an auctioning platform which allows selling only at x:00 time during all 24 hours. Means if the book can only be sold at 1:00, 2:00, 3:00 ..... time during all 24 hours in the day, can't be sold in the middle. And once auction starts happening, you have the choice at every hour (x:00 time) if you want to sell the book at the current auction price or keep on raising the price. You have unlimited supply of book copies, so if you sell a copy of the book, you can start auction for next copy of the book. Only one copy of book can be sold at one auction. You have been provided a list of profit predictions for each hour of auction cycle like this
* AuctionCyle, Profit
- 1 , 20
- 2, 15
- 3, 34
- 4, 23
- ........
- .....
- 24, 16.
This basically represents if you try to keep selling after every hour, you can expect profit of 20 on each hour, and so on so. So now you have to calculate the auction cycles in which you can make the most of the profit from the given profitPredictions.
So like in above table, if you keep selling at every hour, you will be making 20*24 = 480 while if you go with keeping two cycle of one hour (2 * 20) + 10 cycles of 2 hours (10*15) = 190, So as output we had the return the list of the auctionCycle hours to gain the maximum profit.
- I couldn't completely solve any one from both of these. I was able to approach both questions, but got stuck while building the solution. First one was similarly to inversionCount, while second one is a variant of rod cutting problem in DP. Interviewer was friendly and cool, He hinted a lot. But I wasn't completely prepared. Result - Rejected after second round.
Learnings: Stick to the basics, and preparation/practice is the key.