Amazon Interview Questions
- 1of 1 vote
AnswersWe are given an unsorted array of n^2 arbitrary numbers, and we must output an n x n matrix of all the inputs such that all the rows and columns are sorted. For example, suppose n=3, n^2=9, and the 9 numbers are just the integers {1,2,...,9}
Possible ouputs include:1 4 7 1 3 5
2 5 8 2 4 6
3 6 9 7 8 9
Show how to sort this array with a Ω(n^2log n) lower bound.
- randyma12 September 14, 2014 in United States| Report Duplicate | Flag | PURGE
Amazon Computer Scientist Algorithm - 1of 1 vote
AnswersGiven an array of integers, but instead of all integers having the same length each can have a different number of bits. For example, the numbers 0 or 1 have 1 bit, 2, 3 have 2 bits, 4,5,6,7 have 3 bits. The TOTAL number of bits of all the integers in the array is n. Describe how to sort the array in O(n) time.
- randyma12 September 14, 2014 in United States| Report Duplicate | Flag | PURGE
Amazon Computer Scientist Algorithm - 0of 0 votes
AnswersMice and holes are placed in a straight line. There are n holes on this line. Each hole can accomodate only 1 mouse. A mouse can stay at his position, move one step right from x to x+1, or move one step left from x to x−1. Any of these moves consumes 1 minute.
- Selfies September 13, 2014 in -
Assign mice to holes so that the time when the last mouse gets inside a hole is minimized.
for example if there are 3 mice positions of mice are:
4 -4 2
positions of holes are:
4 0 5
the answer should be 4
because:
Assign mouse at position x=4 to hole at position x=4 : Time taken is 0 minutes
Assign mouse at postion x=-4 to hole at position x=0 : Time taken is 4 minutes
Assign mouse at postion x=2 to hole at postion x=5 : Time taken is 3 minutes
After 4 minutes all of the mice are in the holes.| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 0of 0 votes
AnswersIn the following equation x, y, and n are positive integers.
- sunil.vvn September 12, 2014 in India
1/x + 1/y = 1/n
For n = 4 there are exactly three distinct solutions:
1/5 + 1/20 = 1/4
1/6 + 1/12 = 1/4
1/8 + 1/8 = 1/4
What is the least value of n for which the number of distinct solutions exceeds one-thousand?| Report Duplicate | Flag | PURGE
Amazon Algorithm - 0of 0 votes
AnswersHow to implement Dictionary, I gave solution using Tries then they asked how to implement using HashMap.
- Rahul September 09, 2014 in India
> What is the advantage of HashMap over Tries.
> What is the advantage of Tries over HashMap.
> How to implement dictionary using HashMap so that when i press a character it will list all the words starting with that character.| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 0 votes
AnswersGiven two Binary Tree, need to check both are same or not(Without using recursion). Extend the solution for Tree.
- Rahul September 09, 2014 in India| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 0 votes
AnswersKnight movement on a chess board...
- Rahul September 09, 2014 in India
Given any source point and destination point. Need to find whether Knight can move to destination or not.
If yes, Then what would be the minimum movement.
Extended Question : Extend the solution when chess size is infinite.
PS : Had to solve without recursion| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 2 votes
AnswersThere are 3 fields in a music list. number of requests, genre name, Index. And list can take upto 1000 entries. An user can search based in genre name, index and number of requests. index and genre name can be optional. Write test cases to get the list searched by user.
- nagendra September 04, 2014 in India| Report Duplicate | Flag | PURGE
Amazon Quality Assurance Engineer Testing - 0of 0 votes
AnswerWhat is the most challenging part in ur carreer?
- nagendra September 04, 2014 in India| Report Duplicate | Flag | PURGE
Amazon Quality Assurance Engineer Testing - 0of 0 votes
Answersyour manager wants 100% automation for a product. But it is not possible. what will you do?
- nagendra September 04, 2014 in India| Report Duplicate | Flag | PURGE
Amazon Quality Assurance Engineer Testing - 0of 0 votes
Answerswrite test cases for group chat?
- nagendra September 04, 2014 in India| Report Duplicate | Flag | PURGE
Amazon Quality Assurance Engineer Testing - 0of 0 votes
AnswersAmazon site is slow. how will you troubleshoot ?
- nagendra September 04, 2014 in India| Report Duplicate | Flag | PURGE
Amazon Quality Assurance Engineer Testing - 0of 0 votes
AnswersFunction generates random numbers every 30 sec. once in a while it takes long time to generate. how will u Debug this?
- nagendra September 04, 2014 in India| Report Duplicate | Flag | PURGE
Amazon Quality Assurance Engineer Testing - 1of 1 vote
AnswersThere are 6 hosts and there are 6 machines in each host. Admin uses dice role to allocate machine to each user. Write test cases for dice role and machine allocation.
- nagendra September 04, 2014 in India| Report Duplicate | Flag | PURGE
Amazon Quality Assurance Engineer Testing - 0of 0 votes
AnswerA function takes 2 inputs and do some computation and stores in cache. If result is already there, it doesn’t do computation and get the results from cache, otherwise it does some computation and get the results and stores in cache. Write test cases for this.
- nagendra September 04, 2014 in India| Report Duplicate | Flag | PURGE
Amazon Quality Assurance Engineer Testing - 5of 5 votes
AnswersGiven three arrays A,B,C containing unsorted numbers. Find three numbers a, b, c from each of array A, B, C such that |a-b|, |b-c| and |c-a| are minimum
- Greg September 04, 2014 in United States
Please provide as efficient code as you can.
Can you better than this ???| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm Arrays C++ Coding - 0of 0 votes
AnswersRecursively implement a function that returns boolean value by checking if a binary tree is binary search tree or not.
- mohanraj1311 September 03, 2014 in United States| Report Duplicate | Flag | PURGE
Amazon SDE1 - 0of 0 votes
AnswersHow does one application implement similar to DropBox? How can we Mmake sure they are in sync for files. How u’ll check for files are downloaded. How u’ll download files. What protocols u’ll use?
- newbee September 02, 2014 in United States| Report Duplicate | Flag | PURGE
Amazon Principal Software Engineer Knowledge Based - 0of 0 votes
AnswersGiven an array of positive and negative numbers(no zeroes),i have to arrange them in such a way that the positive and negative numbers should be arranged consecutively.The number of positive and negative numbers may not be equal i.e. if there is no positive number(or negative) left,then all the remaining negative numbers(or positive) are appended to the end of the array.The order is important i.e.if input array is { 2,-1,-3,-7,-8,9,5,-5,-7},then the output array should be {2,-1,9,-3,5,-7,-8,-5,-7}.The code is done in O(n) without using another array.I came up with a solution in which i chose 0 as pivot element and separate the numbers (using quicksort) but in this case the order is not preserved.
- sudeep.chauhan24 September 01, 2014 in India| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Arrays - -6of 6 votes
AnswersTraveling Salesman Problem
- blessedmanisha86 August 31, 2014 in India| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 0of 0 votes
AnswersDefine a class Marks as having the fields marks1, marks2, marks3 and maxMarks all of type int.
- ruhi August 31, 2014 in United States
In the class Marks
- define a constructor of the class whch takes 3 ints as input and assigns them to marks1, marks2 and mark3 respectively. It aslo assigns the maximum of marks1, marks2 and marks3 to maxMarks.
- define a method getMaxMarks() which returns the maximum of marks1, marks2 and marks3.
- define a method isPass() which returns true if the average of marks1, marks2 and marks3 is at least 40.
Define a class StudentList which has the field allMarks(of type Marks[]). In the class, define the methods
- totalStudents() which returns the number of total students which is the number of objects in the array allMarks
- passCount() which returns the number of students who have passed.| Report Duplicate | Flag | PURGE
Amazon - 0of 0 votes
AnswersGiven a 2-dimensional array with arbitrary sizes and contains random positive values, you are required to move from the first element [0][0] to the last element [n][n] using the path which will yield the maximum sum of all the elements traversed. You can only move right and down; NOT left and up.
- Teh Kok How August 30, 2014 in United States| Report Duplicate | Flag | PURGE
Amazon Algorithm - 2of 2 votes
AnswersDesign a Meeting Reminder Pop-up similar to one found on outlook.
- R@M3$H.N August 29, 2014 in India
Data Structure to be used and come up with classes.| Report Duplicate | Flag | PURGE
Amazon SDE-2 - 1of 3 votes
AnswersJAVA:
- abcabc August 29, 2014 in United States
Given an array say of length 1000; Pick up every value from every 20th index and store it in a separate array. Make sure to loop through all the elements in the array. Example: newArray1 = {0, 20, 40, 60, ..};
newArray2 = {1, 21,41, 61, ..};| Report Duplicate | Flag | PURGE
Amazon Software Engineer Intern Data Structures - 0of 0 votes
AnswersOn a very large rotated sorted array with one or more duplicates, find the index of a particular number: 20,30,30,45,60,60,5,17,17,19
- Digi Digi August 27, 2014 in India| Report Duplicate | Flag | PURGE
Amazon SDE1 - 0of 0 votes
AnswersHow would you architect a client based recommendation feature(based on customer history) on product detail page?
- Digi Digi August 27, 2014 in India| Report Duplicate | Flag | PURGE
Amazon SDE1 - 0of 0 votes
AnswersDesign Customers who viewed this also viewed that for an online shopping portal
- Digi Digi August 27, 2014 in India| Report Duplicate | Flag | PURGE
Amazon SDE1 - 0of 0 votes
AnswersHow to find non- common elements between two string arrays. Eg: String a[]={"a","b","c","d"};
- ananth.gorthi August 24, 2014 in India
String b[]={"b","c"};
O/p should be a,d| Report Duplicate | Flag | PURGE
Amazon SDE-2 Java - 0of 0 votes
AnswersConsider a regular polygon with N vertices labelled 1..N. In how many ways can you draw K diagonals such that no two diagonals intersect at a point strictly inside the polygon? A diagonal is a line segment joining two non adjacent vertices of the polygon.
- Rahul Sharma August 24, 2014 in India
Input:
The first line contains the number of test cases T. Each of the next T lines contain two integers N and K.
Output:
Output T lines, one corresponding to each test case. Since the answer can be really huge, output it modulo 1000003.
Constraints:
1 <= T <= 10000
4 <= N <= 10^9
1 <= K <= N
Sample Input:
3
4 1
5 2
5 3
Sample Output:
2
5
0
Explanation:
For the first case, there are clearly 2 ways to draw 1 diagonal - 1 to 3, or 2 to 4. (Assuming the vertices are labelled 1..N in cyclic order).
For the third case, at most 2 non-intersecting diagonals can be drawn in a 5-gon, and so the answer is 0.| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 0of 0 votes
AnswersA file of encoded message contains only numbers. Original message contains only lowercase letters and spaces. So character ‘a’ is mapped to 1 ‘b’ to 2 and so on till ‘z’ is mapped to 26. Given an input of numbers find out the number of ways you can decode it in original message. Eg. 123 can be decoded in 3 ways as 'abc', 'lc' or 'aw'
- MVVSK August 22, 2014 in India| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm