Amazon Interview Questions
- 2of 0 votes
AnswersWrite a function: you have an array, which consists of some number which are duplicated 2n times, only one number is duplicated 2n+1 times. Your input parameters are the array and the length of the array. Output the number which is duplicated 2n+1 times. I initially told about XOR, but he then told me XOR is not allowed.
- armisho July 22, 2008| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding - 2of 0 votes
Answerslink list
- jack July 11, 2008
struct node
{
int d;
struct node *next;
struct node *random;
}
random is a pointer which can point to any link in the link list.One link list is given, you have to create the copy of that link list| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 2of 0 votes
AnswersWhat are memory static variables are created?
- Alok Kesharwani June 15, 2008| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Terminology & Trivia - 2of 0 votes
AnswersDesign for card game where you have a deck, cards, players. This was straight from Career Cup.
- hipy16 July 22, 2008
I had given a simpler design first with no factory pattern. He extended the problem to have functionality for creating some different kinds of decks also. So I introduced Factory pattern in my design.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Object Oriented Design - 2of 0 votes
Answerswhy all of the following are considered as bad hash functions?
- Anonymous October 21, 2008
1. Random(0,N)
2. 2*n mod 31
3. n mod 15
4. n mod 31 + 2
Give correct reasons.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer - 2of 0 votes
AnswersFibonacci Series: write a simple algorithm to find it. He first wanted me to write a recursive one.
- hipy16 July 22, 2008
What is the running time of this recursive one?
Can you write a better implementation? Its running time? Asked to code it in Java dictate the code.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Coding - 1of 7 votes
AnswersGiven an array of numbers, arrange it such that all the numbers less than a given key should come before the key and all the numbers greater than the key should come after it.
- Vasily_Zaytsev June 30, 2013 in United States
For example: arr = { 0, -1, -2, 2, 0, 3, 5}, given key = 0
answer should be {-1, -2, 0, 0, 2, 3, 5}
Order of elements that are smaller or greater than key does not matter i.e. sorting is not expected. So, {-1,-2, 0, 0, 5, 2, 3} is also a correct answer.
Time complexity should not be more than O(n).| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Arrays - 1of 7 votes
AnswersProvide a datastructure that can perform :
- Nascent February 21, 2013 in India
1. insert
2. delete
3. find min
4,. find max
5. delete min
6. delete max
all in O(1) time.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer - 1of 7 votes
AnswersGiven an excel column number convert it to excel column alphabet and reverse.
- codechamp March 30, 2014 in India for AWS
Example : If column number(starts from 0) = 26 : Column alpha = AA.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm Brain Teasers Data Structures - 1of 5 votes
AnswersYou have a huge set of stars as three dimensional coordinates. How would you find the k closest stars?
- Nascent July 10, 2013 in United States| Report Duplicate | Flag | PURGE
Amazon - 1of 5 votes
AnswersFind sum of n elements after kth smallest element in BST. Tree is very large, you are not allowed to traverse the tree.
- gvikram244 December 06, 2016 in India| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 1of 3 votes
AnswersGiven 2 binary arrays A and B i.e. containing only 0s and 1s each of size N.
- tryingtosolvemystery August 07, 2013 in India
Find indices i,j such that Sum of elements from i to j in both arrays is equal and j-i (i.e. the length of the set i,j) is the maximum possible value.| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 1of 3 votes
AnswersYou are given a 2D Array that contains only 0s and 1s in sorted order. i.e. First Os and then 1s.
- tihor January 24, 2015 in India
Array:
0 0 0 1
1 1 1 1
0 0 1 1
0 1 1 1
You have to figure out the row that contains maximum number of 1s.
e.g. in above case we have row 2 as the answer.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 1of 3 votes
AnswersIn a Binary Tree, weight of each node is described by the value of the node multiplied by the level (i.e. for root node value is 1* value in root node), And the weight of tree is sum of all the node weights.
- prabal77 August 06, 2013 in India
Find the minimum tree weight out of all the binary trees possible from a given set of numbers.
P.S: No input and no sample data provided| Report Duplicate | Flag | PURGE
Amazon SDE-2 Data Structures - 1of 3 votes
AnswersCode to find the Longest Increasing Subsequence of an array. Not the length but output the numbers.
- Nascent July 02, 2013 in India| Report Duplicate | Flag | PURGE
Amazon - 1of 3 votes
AnswersGiven a binary tree, a complete path is defined as a path from root to a leaf. The sum of all nodes on that path is defined as the sum of that path. Given a number K, you have to remove (prune the tree) nodes from the tree which lie on a path having sum less than K.
- seth June 04, 2013 in India
Note: A node can be part of multiple paths. So we have to delete it only in case when all paths from it have sum less than K.| Report Duplicate | Flag | PURGE
Amazon SDE1 Data Structures - 1of 3 votes
AnswersGiven a matrix, you need to create another matrix such that the value (i,j) is either -1, 0 or 1.
- celeritas February 08, 2014 in United States
1 - if multiplication of all values in ith row and jth column is greater than 0.
-1 - if multiplication of all values in ith row and jth column is less than 0.
0 - if multiplication of all the values in ith row and jth column is 0.
e.g.
1 2 3 1
1 0 -1 2
-1 1 1 1
o/p
-1 0 -1 1
0 0 0 0
1 0 1 -1| Report Duplicate | Flag | PURGE
Amazon Software Engineer Intern Algorithm - 1of 3 votes
Answers== Question ==
- zhaolixi1991 October 30, 2014 in United States
Given a list of TestResult, where each result contains a test score, a student ID and a date, figure out the students' final scores. A final score is the average of a student's top 5 scores.
Here is a sample of the list of TestResult:
50 JACK 5/14/2013
89 ALICE 3/25/2012
70 BOBBY 12/7/2010
60 JACK 8/9/2013
99 MIKE 9/11/2011
100 JOHN 7/4/2011
38 JACK 1/28/2014
46 JACK 11/15/2012
<... more ...>
struct TestResult {
score,
student_id,
date,
}| Report Duplicate | Flag | PURGE
Amazon Intern Algorithm - 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 - 1of 3 votes
AnswersCode to create a file system.... Have classes like directory, file and all
- nr April 21, 2013 in United States for Kindle
please write the full code| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - 1of 3 votes
AnswersDesign an order tracking system using the below constraints.
- gauravkumar1491 September 07, 2017 in India
Once an order is received, it will be assigned to a delivery boy and sends notification at every stage of the order such as order received with expected time of delivery, delivery boy assigned, order picked up, order delivered.
State how your design will help scale and what will be the performance SLAs that will you will set for your design. The system should be able to horizontally scalable from hundreds of orders to million orders and should perform at almost the same level irrespective of the number of orders received.| Report Duplicate | Flag | PURGE
Amazon SDE-2 System Design - 1of 3 votes
AnswersTell me about a time when you not just met your goals but exceeded the expectations
- yjagger1246 October 09, 2021| Report Duplicate | Flag | PURGE
Amazon SDE-2 Behavioral - 1of 3 votes
Answerwrite test cases to test amazon website
- Royal October 08, 2013 in United States| Report Duplicate | Flag | PURGE
Amazon Quality Assurance Engineer - 1of 1 vote
AnswersYou are given an array ' containing 0s and 1s. Find O(n) time and O(1) space
- Anonymous August 25, 2010
algorithm to find the maximum sub sequence which has equal number of 1s and
0s.
Examples
1) 10101010
The longest sub sequence that satisfies the problem is the input itself
2)1101000
The longest sub sequence that satisfies the problem is 110100| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 1of 1 vote
AnswersYou are given two numbers in the form of linked list.Add them without reversing the linked lists. linked lists can be of any length.
- manjunath426jc December 26, 2011 in India
Ex:123 1->2->3
10234 1->0->2->3->4
ans: 10357 1->0->3->5->7| Report Duplicate | Flag | PURGE
Amazon Qualcomm Software Engineer / Developer Linked Lists - 1of 1 vote
AnswersConsider a series in which 8 teams are participating. each team plays twice with all other teams. 4 of them will go to the semi final.How many matches should a team win, so that it will ensure that it will go to semi finals.?
- putta.sreenivas May 11, 2011| Report Duplicate | Flag | PURGE
Amazon Google Developer Program Engineer Software Engineer / Developer Algorithm Brain Teasers - 1of 1 vote
AnswersWith a linked list data structure, find if a given string is palindrome or not.
- sathish.leo May 26, 2012 in United States| Report Duplicate | Flag | PURGE
Expedia Amazon Software Engineer / Developer Linked Lists