Amazon Interview Questions
- 2of 2 votes
AnswersDesign a vending machine
- JSDUDE October 27, 2014 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Object Oriented Design - 0of 0 votes
AnswersGiven a sorted array with some sequenced numbers and some non-sequenced numbers. Write an algorithm that takes this array as an input and returns a list of {start, end} of all consecutive numbers. Consecutive numbers have difference of 1 only.
E.g. of array:
[4, 5, 6, 7, 8, 9, 12, 15, 16, 17, 18, 20, 22, 23, 24, 27]
- JSDUDE October 27, 2014 in United Statespublic class Range { private int begin; private int end; public int begin { get; set; } public int end { get; set; } }
| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Arrays - 10of 10 votes
AnswersYou are given with an array of 1s and 0s. And you are given with an integer m, which signifies number of flips allowed.
- Hitman October 22, 2014 in United States
find the position of zeros which when flipped will produce maximum continuous series of 1s.
e.g.
input:
arr={1 1 0 1 1 0 0 1 1 1 } m=1
output={1 1 1 1 1 0 0 1 1 1} position=2
arr={1 1 0 1 1 0 0 1 1 1 } m=2
output={1 1 0 1 1 1 1 1 1 1} position=5,6| Report Duplicate | Flag | PURGE
Amazon Algorithm - 0of 0 votes
AnswersThis test was on https://www.hackerrank.com
- JSDUDE October 22, 2014 in United States for TRMS
Input is a string of Bytes E.g.341B
Convert it to human readable form: 3 characters long (excluding decimal)
No trailing or leading zeros
E.g:
Input 341B
Output 341B
Input 12345B
Output 12.3K
Input 1234567B
Output 1.23M
Input 1000000000B
Output 1G
Do not round off
Assume input will not be more than 1G
For this problem 1000B = 1K, so on and so forth| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 1of 1 vote
AnswersWrite 4 testcases for the usecase "Customer buys a book with the credit card payment option."
- Ems October 21, 2014 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer in Test - 0of 0 votes
AnswersWrite 4 testcases for the usecase "Customers buy a book with the credit card payment option."
- Ems October 21, 2014 in United States| Report Duplicate | Flag | PURGE
Amazon Testing / Quality Assurance - 0of 0 votes
AnswerWrite a test plan for the first time launch of a website that will sell digital books.
- Ems October 21, 2014 in United States| Report Duplicate | Flag | PURGE
Amazon Testing / Quality Assurance - -2of 2 votes
AnswersGiven an array of numbers print the values in diagonal format.
- dd.metro October 21, 2014 in United States
Example (1) for 8 dataset
Input Array : [1, 2, 3,4,5,6,7,8]
Output
01 02 04 07
03 05 08
06
Example (2) for 45 dataset
Input Array: [1, 2, 3,4,5,6,7,8,9,10……….44, 45]
Output
01 02 04 07 11 15 19 23 27 31 35 39
03 05 08 12 16 20 24 28 32 36 40 43
06 09 13 17 21 25 29 33 37 41 44
10 14 18 22 26 30 34 38 42 45
Code in Java.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer - 1of 1 vote
AnswersReplace %20 with ' '.
- Lawjick October 16, 2014 in United States
E.g. input: www.space%20.com
output: www.space .com| Report Duplicate | Flag | PURGE
Amazon SDET String Manipulation - 0of 0 votes
AnswersSuppose I am given a set of input strings input[5](five of them) and their corresponding replacement strings replace[5]. Then I am given an input text, how can I replace the strings in the text matching any of the inputs with their corresponding replacements.
- mikewhity October 16, 2014 in United States
Also I have to make sure that if suppose, I find a match input[0] and I replace it by replace[0], then because of that it could be possible that I have a new match for input[2] lets say because of the new characters added by replace[0]. I don't want to make replacements with replace[2].
Also I cannot use regex of java.| Report Duplicate | Flag | PURGE
Amazon Software Development Manager Replacing multiple string occurences from a text - 0of 0 votes
Answersdesign a algo so that it receive an input
787668 787787 787948 787980 788094 788124
and produce the output the difference of two consecutive numbers
119,161,32,114,30
the input can varry to any length
- an25081981 October 15, 2014 in India| Report Duplicate | Flag | PURGE
Amazon Developer Program Engineer Algorithm - 0of 0 votes
Answersdesing a algo so that it receive an input
787668 787787 787948 787980 788094 788124
and produce the output the difference of two consecutive numbers
119,161,32,114,30
the input can varry to any length
- an25081981 October 15, 2014 in India| Report Duplicate | Flag | PURGE
Amazon Developer Program Engineer Algorithm - 1of 1 vote
Answers
- Aspire October 11, 2014 in United StatesGiven a String s and a hashmap containing certain decodings for all the characters of alphabet. Find all possible passwords that can be generated by replacing decodings in the string s. Note that decodings of a charachter can only be single charachters Eg: String s="abcde" decodings given a-{1,2,p,o,q} b-{2,y} c-{p} d-{4,a,m,n} e-{9,z,x} h-{1} ' ' ' x-{0} y-{4,k,l} z-{r,5} So possible set passwords will be abcde,1bcde,2bcde,pbcde,obcde,qbcde, //replace a with all possible decodings a2cde,12cde,22cde,p2cde,o2cde,q2cde,aycde,1ycde,2ycde,pycde,oycde,qycde //replace b will all possible decodings a2pde,12pde,22pde,p2pde,o2pde,q2pde,aypde,1ypde,2ypde,pypde,oypde,qypde.....//replace c will all possible decodings
| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 0of 0 votes
AnswersImplement bool isPalindrome(SingleLinkList *node) in constant Space.
- hprem991 October 11, 2014 in United States for Chennei
Sorry for incomplete post earlier..| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer C++ - 0of 0 votes
AnswersImplement bool regex() Function.
- hprem991 October 11, 2014 in India for Chennei| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer C++ Coding - 1of 1 vote
AnswersImplement bool isBST(Tree * root)
- hprem991 October 11, 2014 in India for Chennei| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer C++ Coding - 0of 0 votes
AnswersGiven a file which contains large number of strings.
- Nascent October 11, 2014 in India
e.g.:my name is XYZ. My emansi XYZ i.e. it has words and reverse of words. There can be the case where no reverse word is present.He told me to print all those pair whose reverse is also present in the file.
For above example output will be:
{name,eman}, {is, si}
Constraints were Minimum space should be used and time complexity should be minimum, further he added don’t compute reverse of string at all.| Report Duplicate | Flag | PURGE
Amazon - 0of 0 votes
AnswerHi,
- CodeNinja October 10, 2014 in United States
Anyone here who has given the Amazon work style and personality test for the SDE/SDET position? If someone could shed some light on what exactly it is?| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Online Test - 0of 0 votes
AnswersHi,
- CodeNinja October 10, 2014 in United States
Anyone here who has given the Amazon work style and personality test for the SDE/SDET position? If someone could shed some light on what it is exactly?| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Online Test - 0of 0 votes
Answerscompare the time complexity of quick ,merge and bubble sort
- sujeet October 06, 2014 in India for n/a| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 1of 1 vote
AnswersGiven a sorted array, construct Balanced BST
- R@M3$H.N October 03, 2014 in India| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 0 votes
AnswersFind all the Leaders in an Array.
- R@M3$H.N October 03, 2014 in India
An Array element is Leader if all the elements following that array element is lesser than or equal to it.
Ex: Arr = {13, 17, 5, 4, 6, 2}
O/p: 17, 6, 2| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 1of 1 vote
AnswersTwo dices are tossed. Once die is regular and the other is biased with probabilities P(1) = P(6) = 1/6, P(2) = P(4) = 0, P(3)= P(5) = 1/3.
- jatson October 03, 2014 in United States for Kindle
Determine the probabilities of obtaining the sum 4.| Report Duplicate | Flag | PURGE
Amazon Dev Lead Dev Lead Math & Computation - 1of 1 vote
AnswersWrite a function to find the nth "ugly number". ugly numbers are numbers that can only be fully divided by 1, 2, 3, 5 and itself.
- ye.henry.tian October 01, 2014 in United States for logistics| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 0of 0 votes
AnswerBox stacking problem with boxes having k dimension, find max height of stack
- sprateek1990 September 29, 2014 in India| Report Duplicate | Flag | PURGE
Amazon Java Developer - 0of 0 votes
AnswersBox stacking problem with variation of boxes having K DIMENSIONS , find the max height of stack of boxes
- sprateek1990 September 29, 2014 in India| Report Duplicate | Flag | PURGE
Amazon Java Developer Algorithm - 0of 0 votes
AnswersFind the permutation of a given string using dynamic programming . Try to do with the best possible time complexity and space complexity .
- AlgoBaba September 27, 2014 in India| Report Duplicate | Flag | PURGE
Amazon Dev Lead Dev Lead Algorithm - 0of 0 votes
Answers// You are given a rectangular grid of binary pixels that can be black or white.
- ATuring September 27, 2014 in United States
// Some of the pixels may be black, but you don't initially know how many or
// where.
//
// Given a starting point (x,y), fill (i.e. make black) the region the pixel is
// in.
. . . . . . . . . . . . . . . . . . . .
. X X X . . X X X . . X X X . . X X X .
. X * X X X X . X . . X X X X X X X X .
. X . . . . . . X . -- > . X X X X X X X X .
. X . . . . . . X . . X X X X X X X X .
. X X X X X X X X . . X X X X X X X X .
. . . . . . . . . . . . . . . . . . . .
* . . . . . . . . . X X X X X X X X X X
. X X X . . X X X . X X X X X X X X X X
. X . X X X X . X . X X . X X X X . X X
. X . . . . . . X . --> X X . . . . . . X X
. X . . . . . . X . X X . . . . . . X X
. X X X X X X X X . X X X X X X X X X X
. . . . . . . . . . X X X X X X X X X X
See the correct drawing here: https://stackoverflow.com/questions/26079328/given-a-starting-point-x-y-fill-the-region-in-a-grid-the-pixel-is-located| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer - 2of 2 votes
Answersn mice are playing in the desert, when one of them notices some hawks flying in the sky. It alerts the other mice who now realize that the hawks are going to attack them very soon. They are scared and want to get inside holes to ensure their safety.
- chhipababa September 27, 2014 in United States
Mice and holes are placed on a straight line. There are m holes on this line. Each hole can accommodate only 1 mouse. A mouse can either stay at its position, or move one step right from x to x+1, or move one step left from x to x-1. Any of these movements takes 1 minute.
Assign mice to holes so that the time required for all the mice to move inside the holes is minimized.
Input Format
The first line contains an integer T, the number of test cases. This is followed by T blocks of input:
First line contains 2 positive integers n and m separated by a single space.
Next line contains n space separated integers, denoting the positions of the mice.
Next line contains m space separated integers, denoting the positions of the holes.
Note: No two holes have the same position.
Output Format
For each testcase, print the minimum time taken by all the mice to reach inside the holes.
Constraints
1 ≤ T ≤ 17
1 ≤ n ≤ 131072
1 ≤ m ≤ 131072
n ≤ m
-108 ≤ mouse[i] ≤ 108
-108 ≤ hole[j] ≤ 108
Sample Input
1
3 4
2 0 -4
3 1 2 -1
Sample Output
3
Explanation
One possible solution is :
Assign mouse at position x=-4 to hole at position x=-1 -> 3 minutes
Assign mouse at postion x=2 to hole at position x=2 -> 0 minutes
Assign mouse at postion x=0 to hole at postion x=3 -> 3 minutes
So the answer is 3, after 3 minutes all of the mice are in the holes.| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 0 votes
Answersnon recursive method to calculate height of the binary tree.
- NEO September 27, 2014 in India| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm