Desi
BAN USER- 0of 0 votes
AnswersWrite your own class for key value store which has four methods:
- Desi in United States for ATG
put(key,value)
get(key)
getRandom() this should return a random value with equal probability
deleteWithKey(key)
I was allowed to use hashmap internally to store data.
this was my second technical phone interview because they wanted to get some more idea about my technical skills.| Report Duplicate | Flag | PURGE
Uber Software Engineer Algorithm - 0of 0 votes
AnswersAt first Interviewer asked me to write a problem to solve sudoku and return error if sudoku is invalid.
- Desi in United States for ATG
I told him I already had seen the problem before and he said he really appreciates my honesty.
this was my second technical phone interview because they wanted to get some more idea about my technical skills.| Report Duplicate | Flag | PURGE
Uber Software Engineer Algorithm - 0of 0 votes
AnswerI dont remember the exact problem anymore. but the problem's solution included going through an array and at every step taking 2 minimum element and adding the result. this also includes the result itself.
- Desi in United States for Robotics
so lets say for following array:
2,54,4,10,1,7
you first take 1 and 2 and add
then add the result 3 to the array
so now your array looks like :
3,54,4,10,7
then you take 3 and 4 and add them and add result back
I basically used a heap where i take two mins and add them and add the result back to heap.
I have give amazon online test twice in last 8 months and both the times the first question was about heaps and second something about finding shorted path in a grid between two cells| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 0 votes
AnswersThe problem was very similar to the problem from geeksforgeeks:
- Desi in United States for Robotics
Shortest distance between two cells in a matrix or grid
Given a matrix of N*M order. Find the shortest distance from a source cell to a destination cell, traversing through limited cells only. Also you can move only up, down, left and right. If found output the distance else -1.
instead of source and destination, they asked for robot to be able to get rid of obstacle at a certain cell.
I have give amazon online test twice in last 8 months and both the times the first question was about heaps and second something about finding shorted path in a grid between two cells| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 0 votes
AnswersDesign amazon online book store.
- Desi in United States for Robotics| Report Duplicate | Flag | PURGE
Amazon SDE-2 System Design - 0of 0 votes
AnswersI am given jobs with starttime and end time and we unlimited VMs. at any point a VM can only take one job. so bascially I had to find overlapping jobs and assign them to different machines and those that are not overlapping could be assigned to same machines. The tricky part was when there are two different overlaps and they could be assigned to 2 machines instead of all overlapping jobs being assigned to different machines.The method should return minimum number of VMs used to finish all jobs.
- Desi in United States for Robotics
I mentioned sorting the jobs based on start time. and then returning number_of_overlapping jobs +1. but again in some cases if there are two different overlaps which could be assigned to two machines then we need to take care of that.| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 0 votes
AnswersExpression tree evaluation and also write the class for the node and tree itself. (just basic structure like node and data)
- Desi in United States for Robotics| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 0 votes
AnswersLRU cache. Basically started off with how would I store values and get them from memory for faster access. So I mentioned HashMap. and then interviewer added more info about deleting least recently used element.
- Desi in United States for Robotics| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 2of 2 votes
AnswersImplement an iterator<WordAndCount> which takes iterator<String> and its next() method returns the count for same word in a row. I was also asked to implement hasNext method.
- Desi in United States
WordAndCount class had two properties:
1. Word
2. Count
I was asked to implement hasNext() and next() method which basically returns a WordAndCount object.
To make it clear, following is the example:
lets say Iterator<String> has following values:
{foo,foo,foo,bar,foo,bar,bar}
iterator<WordAndCount> next() method should return this:
{{foo,3},{bar,1},{foo,1},{bar,2}}
It seemed like an easy problem and because we ran out of time during coding i think interviewer didn't ask me the follow up question. Interviewer was nice and he told me he doesn't expect me to code in time limit but he only wants to see how i approach the problem.| Report Duplicate | Flag | PURGE
Google Software Engineer - 0of 0 votes
AnswersGiven a nxn grid with 1's and 0's find the length of largest black square formed with 1's.
- Desi in United States for ATG
So for below example:
00000
11110
01111
01110
The largest square length is 3.
With dynamic programming it can be done in O(n^2) time
It was a technical screen but it was taken in person for an event.| Report Duplicate | Flag | PURGE
Uber Software Engineer Algorithm
Just an update: after exploring on how to solve this problem, interviewer gave me hint for brute force and then because of time limit I was asked to code. And even though i thought my interview didn't go well, I just got email saying they just moved me forward for onsite interview. Just sharing my experience if it helps other people. its not necessary for people to come up with optimal solution everytime as long as you discuss your thought process and work as a team.
- Desi May 03, 2019
Uber ATG
- Desi May 21, 2019