Amazon Interview Questions
- 1of 1 vote
AnswersYou have a BST and you need to assign an appropriate value to neighbor of all nodes (Explained in below example)
Node Structurenode { node leftChild, node rightChild, T data, node neighbor }
A
- avinash.setty December 12, 2015 in United States for Marketplace
/ \
B C
/ \ \
D E F
Based on above tree,
Node: Neighbor
A: NULL
B: C
D: E
E: F| Report Duplicate | Flag | PURGE
Amazon SDE-2 Trees and Graphs - 1of 1 vote
AnswersWrite a program to remove duplicates from array of prime numbers.
- onlinesoumitra June 14, 2013 in United States| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 1of 1 vote
AnswersFind the intersection of 2 unsorted arrays.
- crackit November 24, 2010
The interviewer asked me about the various methods possible and asked me to code one.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 1of 1 vote
AnswersFind a median of two sorted integer arrays.
- geeky_freak July 22, 2008| Report Duplicate | Flag | PURGE
VMWare Inc Amazon Software Engineer / Developer Algorithm - 1of 1 vote
Answersgiven a LinkedList like 1->2->3->4->5->6
- ganesh.eng2015 July 30, 2016 in India
Modify it as:
1->6->2->5->3->4| Report Duplicate | Flag | PURGE
Amazon Backend 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 - 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 - 1of 1 vote
AnswersFind if all the leaf nodes are at same level in binary tree.
- poojabasia September 26, 2013 in India
Recursive and non-recursive approach?| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding - 1of 1 vote
AnswersYou are given a BST, and min, max elements. Your task is to trim this BST so that it contains the elements between the min and the max elements.
For example, given the mix and max elements [5, 13] and the tree below, you would return the output below.8 3 10 1 6 14 4 7 13
output should be :--->
- Abhishek Shrivastava April 20, 2013 in United States8 6 10 7 13
| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 1of 1 vote
Answersyou have an array which has a set of positive and negative numbers, print all the subset sum which is equal to 0.
- AlgoBaba March 29, 2014 in United States
eg 2, 1, -1, 0, 2, -1, -1
o/p: 1, -1
1, -1, 0
0
2, -1, -1| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer - 1of 1 vote
Answersgiven a very large file with words. Reverse the order of all words. For Example: How are you doing today? -->>today? doing you are How I know you may say reverse the whole and reverse each word but, the interviewer said that the file is too big to fit into the memory and the file should be read through a inputStream object, then write the result file to harddisk.
- qq416603 November 30, 2012 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 1of 1 vote
AnswersRemove 3 consecutive duplicates from string.
- neerdis January 17, 2017 in India
INPUT:aabbbaccddddc
OUTPUT:cdc| Report Duplicate | Flag | PURGE
Amazon Developer Program Engineer Java - 1of 1 vote
AnswersGiven a binary tree and a target number, return whether or not there exist a path that can create target number. All inputs are integers. Target is not a string.
- cool November 22, 2016 in United States
NOTE:: this is not path sums to target number
ex:
3
4 5
6 7 8 9
359 = return true
38 = return false
47 = return true
6 = return true| Report Duplicate | Flag | PURGE
Amazon Software Engineer Algorithm - 1of 1 vote
AnswersPrint first and last node of all the levels of a tree.
- neer.1304 September 19, 2015 in United States
Ex if tree is -
root->data = 1
root->left->data = 2
root->right->data = 3
root->left->right->data = 4
root->right->right->data = 6
root->right->left->data = 5
root->right->left->left->data = 7
root->right->left->left->right->data = 8
Output - 1 2 3 4 6 7 8| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 1of 1 vote
AnswersGiven a large file of (x,y) coordinates. Find the k farthest points from origin.
- Nascent May 14, 2013 in India| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer - 1of 1 vote
Answersfind the next greatest number that can be form by same digit of the given number ..
- pintuguptajuit(PINTU GUPTA) March 24, 2013 in United States
sample test case
input
4765
output
5467| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 1of 1 vote
AnswersTable: Student
- padmarajuharish March 08, 2017 in United States
Fields: Student_ID, Department, Start_Date
ex: 1,A, 2017-01-1
1,B, 2017-07-1
1,C, 2017-12-1
Expected Output: Student_ID, Department, Start_Date, End_Date
ex: 1,A, 2017-01-1, 2017-07-01
1,B, 2017-07-1,2017-12-01
1,C, 2017-12-1, ...
End_Date is the start Date of the next record for the student ID| Report Duplicate | Flag | PURGE
Amazon SQL - 1of 1 vote
AnswersWe've 1 book left in the inventory. and two people are trying to get the same book ( say person x and person y ). Person x has added book to the cart and about to make payment and person y has also added book to the cart. How would you solve this concurrency problem ?
- the-awakened-1 April 22, 2015 in United States| Report Duplicate | Flag | PURGE
Amazon System Design - 1of 1 vote
AnswersGiven an unsorted array of ints,sort the shortest sub-array which results in sorting of the whole array.
- R@M3$H.N September 18, 2014 in India
Ex:
i/p: [-1,0,4,3,2,1,7,8,9]
By sorting sub array [4,3,2,1] the whole Array is sorted.
i/p: [10, 15, 20, 30, 25, 40, 35, 45, 50, 60]
By sorting sub array [30, 25, 40, 35] the whole Array is sorted.
i/p: [-1,0,4,3,2,1,7,8,9,-2]
Shortest sub-arry to be sorted is [-1,0,4,3,2,1,7,8,9,-2]| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 1of 1 vote
AnswersGiven A Binary Tree of size n , Find Out a Matrix M[n][n], where M[i][j]=1 if i is predecessor of j, else M[i][j]=0.
- gdg June 26, 2014 in United States
Try to do in better than O(N^2) time.| Report Duplicate | Flag | PURGE
Amazon Algorithm - 1of 1 vote
AnswersLet’s say you have two input arrays with sorted elements. Find the union.
- prasad.hybris May 16, 2018 in United States
a[] = {2, 10, 14, 19, 51, 71}
b[] = {2, 9, 19, 40, 51}
Union = {2, 9, 10, 14, 19, 40, 51}| Report Duplicate | Flag | PURGE
Amazon SDE1 Java - 1of 1 vote
AnswersFind the max poduct value of 3 number from the given array .
- sathyamoorthybe May 06, 2016 in India
For example , if array has [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16] find the max product from three numbers. max_product(x*x*x)
Twist is array can contain negative number as well| Report Duplicate | Flag | PURGE
Amazon Quality Assurance Engineer Quality Assurance - 1of 1 vote
AnswersAlgorithm to check a linked list is palindrome or not, each node contains a single character.
- Ajay Kumar February 27, 2012 in India for Development| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer - 1of 1 vote
AnswersGiven a string and two words which are present in the string, find the minimum distance between the words
- testsync012345 October 23, 2015 in United States
Eg: "the brown qucik frog quick the", "the" "quick" O/P -> 1
"the quick the brown quick brown the frog", "the" "the" O/P -> 2| Report Duplicate | Flag | PURGE
Amazon Quality Assurance Engineer Algorithm - 1of 1 vote
AnswersYou have a binary search tree and you have to return the two nodes such that there sum i equal to ‘K’. Pseudo code is to be given.
- tihor January 26, 2015 in India
O(n)time & O(n) sppace is easy but challenge O(n) time & O(1) space.| Report Duplicate | Flag | PURGE
Amazon Java Developer Algorithm - 1of 1 vote
AnswersWrite a program to reverse contents of a file in place..for example if file has "abcde" after executing program the contents should be "edcba". The program should be efficient.. You can use fwrite & fread apis...
- sandeep.bvb January 10, 2015 in United States
I wrote using fread and fwrite, by reading 1 char at a time and replacing with one at the other end.. He seemed not happy as the I/O was high...| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer C#