Amazon Interview Questions
- 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 Senior Software Development Engineer Algorithm - 1of 1 vote
AnswersHow will you design, and what data structure will you use for a contact list in a cell Phone. It should support insert/modify/delete/search functionality like that provided in a cell phone.
- anurag6989 August 21, 2014 in India
Suppose some of the entries are
Aman
Amazon
Neha Aman
and we type 'ama'
then the result should show all the above three enteries.
Also it should be possible to search using phone numbers.| Report Duplicate | Flag | PURGE
Amazon SDE-2 Data Structures - 0of 0 votes
AnswersThere are 8 statues 0,1,2,3,4,5,6,7 . Each statue is pointing in one of the following four direction North, South, East or West.
- viksolanram4 August 18, 2014 in United States
John would like to arrange the statues so that they all point in same direction. However John is restricted to the following 8 moves which correspond to rotation each statue listed 90 degrees clockwise. (N to E, E to S, S to W, W to N)
Move A: 0,1
B: 0,1,2
C: 1,4,5,6
D: 2,5
E: 3,5
F: 3,7
G: 5,7
H: 6,7
Help John figure out fewest number of moves to help point all statues in one direction.
Input : A string initialpos consisting of 8 chars. Each char is either 'N,'S,'E,'W'
Output: An integer which represents fewest no. of moves needed to arrange statues in same direction. If no sequence possible then return -1.
Sample test cases:
input: SSSSSSSS
Output: 0
Explanation: All statues point in same direction. So it takes 0 moves
Test case 1:
Input : WWNNNNNN
Output: 1
Exp: John can use Move A which will make all statues point to North
Test Case 3:
input: NNSEWSWN
Output: 6
Exp: John uses Move A twice, B once, F twice, G once. This will result in all statues facing W.
Note: Read input from stdin and output from stdout| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 1of 1 vote
AnswersHere is the structure of a tree:
Node {
int value;
Node *parent;
}
All nodes are stored in a list right now
List {
Node n;
List *next;
}
print out each layer from left to right in a vertical position:
- jstw August 18, 2014 in United Statesroot layer1Child1 layer2Child1 layer4Child1 layer1Child2 layer2Child2 layer2Child3
| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 0of 0 votes
AnswersDesign a system that processes an infinite stream of data:
- takpez August 18, 2014 in United States for AWS
- each record comes as a tuple(url, html content)
- extract and store the occurences of:
urls, hosts, top-level-domains, in/out links of the page
We have one machine that has enough disk space but limited memory.
What data structures as building blocks would you use?| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer System Design - 0of 0 votes
AnswersGiven a sorted array of 0’s and 1’s. Find out the no. of 0’s in it. Write recursive, iterative versions of the code.
- Saurabh2816 August 17, 2014 in India| Report Duplicate | Flag | PURGE
Amazon Intern Arrays - 1of 1 vote
AnswersGiven a n-ary tree, Convert it into an array and return it. Construct the same n-ary tree from that array again.
- Saurabh2816 August 15, 2014 in India| Report Duplicate | Flag | PURGE
Amazon Intern C# - 0of 0 votes
AnswersGiven a 20 GB file and 2GB RAM, how to parse it and detect where to break it, concepts of memory management.
- Saurabh2816 August 10, 2014 in India| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Operating System - 0of 0 votes
AnswersHow to remove file named "~" ?
- Pinky August 09, 2014 in India for ECOX| Report Duplicate | Flag | PURGE
Amazon SDE1 Unix - 2of 2 votes
AnswersGiven a file containing a list of ip addresses that have lost their dots(.'s), write a program to find the ip addresses, assume ipv4. input: 11111 output. 1.1.1.11, 11.1.1.1, etc
- rk August 09, 2014 in United States| Report Duplicate | Flag | PURGE
Amazon SDE1 - 1of 1 vote
AnswersYou are given an array, that is sorted, however was rotated to the right by a certain distance. The array may contain duplicated values. Find the index of a given element in the array.
- joe kidd August 03, 2014 in India
Example: {3, 9, 9, 9, 8, 10, 12, 13, 1, 2, 3}, element = 3, returns, any of indexes that 3 is present.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 0of 0 votes
AnswersGiven an array containing only stars '*' and hashes '#' . Find longest contiguous sub array that will contain equal no. of stars '*' and hashes '#'.
- Peter August 03, 2014 in India
Order (n) solution required| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 3of 3 votes
AnswersGiven a 2 dimensional matrix where some of the elements are filled with 1 and rest of the elements
- mknarayan1711 August 02, 2014 in India for Media Experience Team
are filled. Here X means you cannot traverse to that particular points. From a cell you can either traverse to left, right, up or down
Given two points in the matrix find the shortest path
between these points
For example if the matrix is
1 1 1 1 1
S 1 X 1 1
1 1 1 1 1
X 1 1 E 1
1 1 1 1 X
Here S is the starting point and E is the Ending point| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 3of 3 votes
AnswersWrite a function to label connected components (using 4-connected neighbors) in a binary image.
- davydany August 01, 2014 in United States
You may use any language or data structures, but you may not use any existing APIs/libraries to find the components.
Example:
Input image
0 0 0 0 0 1 1 0 0 0
1 1 0 0 1 1 0 0 0 0
1 1 1 0 0 1 1 0 0 0
0 0 0 1 1 0 0 0 0 0
Output Image
0 0 0 0 0 1 1 0 0 0
2 2 0 0 1 1 0 0 0 0
2 2 2 0 0 1 1 0 0 0
0 0 0 3 3 0 0 0 0 0| Report Duplicate | Flag | PURGE
Amazon Research Scientist Algorithm - 1of 1 vote
AnswersGiven a multidimensional array like below:
0 1 0 0 3 0 3 3 0 0 0 0 0 0 2 0 0 1 0 2 0 0 0 0 0
"objects" are considered groups of numbers that touch along top, left, right, or bottom edges.
- Chris July 30, 2014 in United States
Find the number of objects.
For example given the above array, your code should detect 4 unique "Objects". {1,3,3}, {3}, {1}, and {2, 2}.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - -2of 2 votes
AnswersTo design classes and methods for casino cards games, what would you consider when doing it?
- yu_stfx@hotmail.com July 30, 2014 in Canada| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Object Oriented Design - 1of 1 vote
AnswersWrite a method that takes a binary tree and return whether the tree is sorted.
- yu_stfx@hotmail.com July 30, 2014 in Canada| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 2of 2 votes
AnswersYou are given an array of both negative and positive integers. You need to rearrange the array such that positive and negative numbers alternate. Also, the order should be same as previous array and only O(1) auxiliary space can be used and time complexity boundation O(n).
- peechus July 29, 2014 in United States
eg. -2 3 4 5 -1 -6 7 9 1
result – 3 -2 4 -1 5 -6 7 9 1.| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 0of 0 votes
Answerswe have website having several web-pages. And also there are lot many user who are accessing the web-site.
- Rahul Sharma July 28, 2014 in India
say user 1 has access pattern : x->y->z->a->b->c->d->e->f
user 2 has access pattern : z->a->b->c->d
user 3 has access pattern : y->z->a->b->c->d
user 4 has access pattern : a->b->c->d
and list goes on for lot many users which are finite and numbered.
Now the question is we have to determine the top 3 most occurring k-Page-sequence.
for the above example result will be : (k=3) a->b->c , b->c->d , z->a->b.| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 2of 2 votes
AnswersWrite a code to test whether string s2 is obtained by rotating the string s1 by 2 places.
- Surekhag28 July 26, 2014 in India for Kindle
e.g S1="amazon" S2="azonam" return true
S1="quality" S2="lityqua" return false| Report Duplicate | Flag | PURGE
Amazon Quality Assurance Engineer Coding - 0of 0 votes
AnswersWrite a code to find duplicate elements in array and total count of duplicate elements.
- Surekhag28 July 26, 2014 in India for Kindle
eg. arr={5,3,4,6,7,5,3,2,1}
Duplicate elements:- 5,3
Total duplicate count:- 2| Report Duplicate | Flag | PURGE
Amazon Quality Assurance Engineer Coding - 0of 0 votes
AnswersWrite the test data for the function which takes input value as floating number and precision. It returns the output by rounding the value nearest to precision value.
- Surekhag28 July 26, 2014 in India for Kindle
e.g roundOff(3.4567,2) output will be 3.55| Report Duplicate | Flag | PURGE
Amazon Quality Assurance Engineer - 0of 0 votes
AnswersHow will you debug the issue when trying to sync the contacts of smartphone with PC and all the contacts does not sync.
- Surekhag28 July 26, 2014 in India for Kindle| Report Duplicate | Flag | PURGE
Amazon Quality Assurance Engineer Debugging - 0of 0 votes
AnswersWrite the test scenarios and test cases for PC based phot o preview software when the camera is connected to PC using USB.
- Surekhag28 July 26, 2014 in India for Kindle| Report Duplicate | Flag | PURGE
Amazon Quality Assurance Engineer Testing - 1of 1 vote
AnswerDesign software system for a multiplex assuming database server is available - List requirements, DB tables design, APIs. Follow up question how to integrate with third party ticketing systems? how to pass seats availability to ticketing systems?
- Arudham July 26, 2014 in India| Report Duplicate | Flag | PURGE
Amazon Program Manager System Design - 1of 1 vote
AnswersGiven an array of heights of poles. Find the no of poles which are visible if you are standing at the ith pole
- Rahul Sharma July 26, 2014 in India| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - -1of 3 votes
AnswersThere are three files
- rajat sadh July 21, 2014 in United States
original.txt,encryption.txt and decryption.txt
original file contains "ABCEZYAR"
it should be encrypt like "12352625118"
and when we decrypt code then original massage should be return "ABCEZYAR".| Report Duplicate | Flag | PURGE
Amazon Software Engineer Intern Algorithm - 0of 0 votes
AnswersAn analyst at Amazon is conducting a satisfaction survey, sampling from a list of 10,000 new users. The list includes 2,500 French users, 2,500 German users, 2,500 Italian users, and 2,500 Portuguese users, The analyst selects a sample of 400 users, by randomly sampling 100 users of each country. Is this an example of simple random sample?
- samworthington93 July 21, 2014 in United States for Operation| Report Duplicate | Flag | PURGE
Amazon Analyst