Amazon Interview Questions
- 0of 0 votes
Answersyou have a dictionary which will return true if the word is present in it otherwise false. You have a string "ABC", check if anagram of "ABC" is present or not. the condition was not to generate the all the anagram of ABC. (Assumption: you can store the dictionary in trie or hashmap (any data structure) and no need to implement the dictionary)
- NEO September 27, 2014 in India| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 0of 0 votes
AnswersAn array of size n is given. The array contains digits from 0 to 9. I had to generate the maximum number using the digits in the array such that it is divisible by 2, 3 and 5
- AlgoBaba September 27, 2014 in India
eg: 1 array = 18760, output must be: 8160
eg: 2 array = 7776, output must be: “no number can be formed”| Report Duplicate | Flag | PURGE
Amazon Algorithm - 6of 6 votes
AnswersComponents of computer systems often have dependencies -- other components that must be installed before they will function properly. These dependencies are frequently shared by multiple components. For example, both the TELNET client program and the FTP client program require that the TCP/IP networking software be installed before they can operate. If you install TCP/IP and the TELNET client program, and later decide to add the FTP client program, you do not need to reinstall TCP/IP.
- Byll September 26, 2014 in United States
For some components it would not be a problem if the components on which they depended were reinstalled; it would just waste some resources. But for others, like TCP/IP, some component configuration may be destroyed if the component was reinstalled.
It is useful to be able to remove components that are no longer needed. When this is done, components that only support the removed component may also be removed, freeing up disk space, memory, and other resources. But a supporting component, not explicitly installed, may be removed only if all components which depend on it are also removed. For example, removing the FTP client program and TCP/IP would mean the TELNET client program, which was not removed, would no longer operate. Likewise, removing TCP/IP by itself would cause the failure of both the TELNET and the FTP client programs. Also if we installed TCP/IP to support our own development, then installed the TELNET client (which depends on TCP/IP) and then still later removed the TELNET client, we would not want TCP/IP to be removed.
Write a program to automate the process of adding and removing components. To do this we will maintain a record of installed components and component dependencies. A component can be installed explicitly in response to a command (unless it is already installed), or implicitly if it is needed for some other component being installed. Likewise, a component, not explicitly installed, can be explicitly removed in response to a command (if it is not needed to support other components) or implicitly removed if it is no longer needed to support another component.
I found a reference to this problem online.. Check this for i/o details. This is the exact same problem
http://www.cs.cornell.edu/Info/Courses/Spring-98/CS211/assgts/assgt3/assgt3.pdf| Report Duplicate | Flag | PURGE
Amazon Senior Software Development Engineer Algorithm - 0of 0 votes
AnswersWrite a program to find first 20 elements with high density
- you.win September 26, 2014 in United States| Report Duplicate | Flag | PURGE
Amazon Senior Software Development Engineer - 0of 0 votes
AnswersHi I wanted to know what I should prepare for an in person interview with amazon for the post of cloud support associate(AWS team)?
- tsh110390 September 25, 2014 in United States for AWS| Report Duplicate | Flag | PURGE
Amazon Cloud Support Associate Experience - 0of 0 votes
AnswersWrite a program to calculate height of a binary tree non - recursively. USE ONLY STACK , not using BFS.
- !@# September 25, 2014 in United States
Then he asked to implement it for n-ary tree.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 0of 0 votes
AnswersMerge two sorted linked list
- LCHammer September 25, 2014 in United States for Advertising| Report Duplicate | Flag | PURGE
Amazon SDE1 Linked Lists - 0of 0 votes
AnswersDesign a stack using queue(s)
- LCHammer September 25, 2014 in United States for Advertising| Report Duplicate | Flag | PURGE
Amazon SDE1 Stacks - 1of 1 vote
AnswersDesign a valet parking system. Requirements of the valet parking system should be:
- LCHammer September 25, 2014 in United States for Advertising
1. Customer are given a ticket that they can use to redeem to get their vehicle back
2. Parking spots come in three sizes, small, med, large
3. Thee types of vehicles, small, med, large
-a small vehicle can park in a small, medium, and large spot
-a medium vehicle can park in a medium and large spot
-a large vehicle can park in a large spot| Report Duplicate | Flag | PURGE
Amazon SDE1 Object Oriented Design - 0of 0 votes
AnswersSuppose you want improve the performance of search queries, using a cache. Each search queries is in form of a string and returns a list of ad id's in the form of longs.
- LCHammer September 25, 2014 in United States for Advertising
Design a class with the appropriate data structure(s) that can manage a cache of search queries.| Report Duplicate | Flag | PURGE
Amazon SDE1 Coding - 0of 0 votes
AnswersSay you have a string:
- LCHammer September 25, 2014 in United States for Advertising
"Thisisasentence"
How would you separate the string into separate words, return either the sentence with spaces or as a list/array where each entry is a word| Report Duplicate | Flag | PURGE
Amazon SDE1 String Manipulation - 0of 0 votes
AnswersHow do a free() knows how much memory has to be free.Suppose
- tauqir0007 September 24, 2014 in India
int *p=(int*)malloc(sizeof(int)*100);
after some operation,
free(p);
Now how free() function knows from where to where memory has to be free?| Report Duplicate | Flag | PURGE
Amazon Developer Program Engineer C# - 2of 2 votes
AnswersHow would you implement virtual functions in C
- iwanna September 24, 2014 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer C# - 0of 0 votes
AnswersHow would you access private data member in a class? This class is defined in a library which you cannot modify. There are no friend functions.
- iwanna September 24, 2014 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer C++ - 0of 2 votes
AnswersHow to implement virtual functions in C?
- iwanna September 24, 2014 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer C - 0of 0 votes
AnswersWrite a function to determine if a binary tree is a true binary search tree and give the average performance of the function.
- Chris September 23, 2014 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 0 votes
AnswersDesign an elevator system for a high rise building.
- Chris September 23, 2014 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 Application / UI Design - 0of 0 votes
AnswersDesign an alarm clock.
- Chris September 23, 2014 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 Application / UI Design - -1of 1 vote
AnswersA Load Balancer has the following functions:
getHost() addHost(String) removeHost(String)
Implement these functions using any data structure you wish. Also indicate the average performance for each function and what you expect to be its call count in a typical system with respect to each other of the three functions. In other words, how often do you expect getHost() to be called compared to addHost(...)?
- Chris September 23, 2014 in United States
Constraints:
Hosts are unique.
getHost() returns a random host from the host group| Report Duplicate | Flag | PURGE
Amazon SDE-2 Data Structures - 0of 0 votes
Answerswrite a function for a BST to implement best case search.If exact search key not available in BST then return best suited key.Ex- if a tree has keys 21 15 26 30 55 7 and if my search key is 25 then this function should return 26.
- tauqir0007 September 22, 2014 in India| Report Duplicate | Flag | PURGE
Amazon SDE-2 C# - 1of 1 vote
AnswersWrite a program to find the smallest number that can be formed by 0 and 9 which is divisible by a given number.
- Shaziya Syeda September 22, 2014 in India
For example, if given number is 3 output should be 9,
if given number is 2 output is 90,
if given number is 10 output is 90,| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - -2of 2 votes
AnswersWrite a program to find the smallest number that can be formed by 0 and 9 which is divisible by a given number.
- Shaziya Syeda September 22, 2014 in India
For example, if given number is 3 output should be 9,
if given number is 2 output is 90,
if given number is 10 output is 90,
if given number is 7 output is 10^23.| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 1of 1 vote
AnswersHow to impliment Google map
- surendersinghpawar September 20, 2014 in India
Data Structure and algorithm.
1. Zoom in/out
2. horizontal/ vertical.
Assumtion - all the image of earth with pixel\Any other assumption is allowed| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm Application / UI Design Data Structures - 1of 1 vote
AnswersHow google map implemented ? zoom in , zoom out, moving horizontal and moving vertically.
- surendersinghpawar September 20, 2014 in India
Give data Structure and algorithm.
Given all the data from satellite which revolve around earth in spiral way.| Report Duplicate | Flag | PURGE
Amazon Member Technical Staff Algorithm Application / UI Design Data Structures - 0of 2 votes
AnswersGiven ten million numbers, each having 11 bits, find the most time efficient way to sort the numbers.
- alregith September 20, 2014 in United States for Marketplace Team| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 0of 0 votes
AnswersGiven an array and a number, find two integers that sums to the given number.
- alregith September 20, 2014 in United States for Marketplace Team| Report Duplicate | Flag | PURGE
Amazon SDE1 Arrays - 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 - 0of 0 votes
AnswersGiven a Tree (binary and unbalanced)
- argho.chatterjee.001 September 18, 2014 in United States for Software development engineer II
Find all the nodes in that tree which are 'n' levels up the leaf node...
Eg:
A->root
A.left=B
A.right=C
B.left=D
B.right=E
C.right=F
D.right=G
then
if 'n' as described in the above problem statement, is say n=2
then
answer should be :
B(2 nodes up from G), A(2 nodes up from E & F)
hence ans is B,A
My Algo was;
1)Perform a DFS (left,middle, right)
2) when leaf node is encountered.. just move the stack pointer (without poping or jsut coy the stack of DFS to another stack and perform a real time pop operation) by 'n' times and then just print the node which it encounters.
code:
int n=2;
Stack treeStack = new Stack();
function find(){
treeStack .push(rootnode);
performDFS();
}
function performDFS(){
if(currnetnode.left==null && currentnode.right==null){
// this is a leaf node.
Stack tmpStack=copyStack(treeStack);
// hard coded logic(two pop operations) without using a loop since i am usnig n=2 in //this example
tmpStack.pop(); // pop 1st element
element = tmpStack.pop(); // print the 2nd element
print(element);
}
if(currnetnode.left!=null)
treestack.push(currentnode.left);
if(currnetnode.right!=null)
tree.stack.push(currentnode.right);
}| Report Duplicate | Flag | PURGE
Amazon Dev Lead Dev Lead Algorithm - 0of 0 votes
AnswersA certain language uses a set of characters from a-z but not in the same sequence as in english.
- algoseeker September 17, 2014 in India
Now, words from the language appear in pair to you. e.g. LMOSS,NMOSS which implies that N comes after L, but not necessarily immediately after L. Similary, other words like{NMORR,TMORR}, { KSINN, KXINN }are also available.
What should be the data structure which should be used so that we can find out the character sequence in this language.| Report Duplicate | Flag | PURGE
Amazon Java Developer Algorithm