Amazon Interview Questions
- 0of 0 votes
AnswersYou have a basket ball hoop and someone says that you can play 1 of 2 games. You get $1000 and one shot to get the hoop. Or, you get three shots and you have to make 2 of 3 shots. Which one do you choose? If p is the probability of making a particular shot, what value of p makes you switch games?
- Gayle L McDowell April 04, 2005| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Math & Computation - -2of 2 votes
Answersgiven an integer array , find all combinations which sum to a given number. If a number is used once, it must not be used again.
- pooja January 31, 2016 in United States
eg if input array is 6444 and sum =10
output must be just 6 4
Give an O(n) solution| Report Duplicate | Flag | PURGE
Amazon Software Engineer Intern - 2of 2 votes
AnswersGiven a sorted array with only 0's and 1's.Count the number of 0's.
- steelrahul June 16, 2015 in India for Hyderabad
e.g: 0 0 0 0 1 1
Ans: 4.| Report Duplicate | Flag | PURGE
Amazon SDE1 - 2of 2 votes
Answersint sum = 0;
- nirupam.astro January 04, 2014 in India
for (int i = 0; i < m; i++)
for (int j = i + 1; j < n; j++)
for (int k = j + 1; k < l; k++)
sum++;
what will be the value of sum?| Report Duplicate | Flag | PURGE
Amazon SDE1 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 - 3of 7 votes
Answersgiven an input array of integers where each integer represent the maximum amount of jump a frog can take.Frog has to reach the end of the array in minimum number of jumps.
- aka[1] August 05, 2013 in United States
Example:[1 5 4 6 9 3 0 0 1 3] answer is 3 for this.
[2 8 3 6 9 3 0 0 1 3] answer is 2 for this.
Any DP solution for this?| Report Duplicate | Flag | PURGE
Amazon Applications Developer Algorithm - -3of 3 votes
AnswersYou have an array of binary numbers as "00001101000001010100000..."... We need to find the First occurrence of 1 in this series.. using binary search.
- imvrajendra May 21, 2013 in India
we need to design an algorithm of complexity less than O(n).. and we need to use binary search strictly..| Report Duplicate | Flag | PURGE
Amazon SDE1 Arrays - 0of 0 votes
Answers2.Given an integer linked list of which both first half and second half are sorted independently. Write a function to merge the two parts to create one single sorted linked list in place [do not use any extra space].
- kumar.prince6 January 13, 2013 in India
Sample test case:
Input: List 1:1->2->3->4->5->1->2; Output: 1->1->2->2->3->4->5
Input 2: 1->5->7->9->11->2->4->6; Output 2: 1->2->4->5->6->7->9->11
C/C++/Java/C#
struct node
{
int val;
node *next;
}
node* sortList(node* list1) {
}
Java
class Node
{
int val;
Node next;
}
Node sortList(Node list1) {
}| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer - 0of 0 votes
AnswersArray on integer is given
- MI December 17, 2012 in India
find out next bigger number
Ex {2,5,3,4,61}
Out: 2->5
5->6
3->4
4->6
6->-1 //not possible
1-> -1 //not possible| Report Duplicate | Flag | PURGE
Amazon - 1of 1 vote
Answersgenerate permutations of a string without duplicates and without using hashtable to memorize the permutations.
- Andi December 05, 2012 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 0of 0 votes
AnswersGive a BST and a number. we need to find next bigger number in BST.
- Harsh123 November 04, 2012 in India for Kindle| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm Data Structures Trees and Graphs - 0of 0 votes
AnswersWrite a program
- ravgvn July 17, 2012 in India
Given an array of N integers . Find the maxproduct of 3 numbers ?| Report Duplicate | Flag | PURGE
Amazon Software Engineer in Test Arrays - 0of 0 votes
AnswersAmazon telliphonic 17 May, 2012
- adarsh May 17, 2012 in India
1.) There is a sequence where aphabets are written like this..
a,b,c,d,.......,x,y,z,aa,ab,ac........,az,ba,bb,bc,bd......bz,ca,cb.........cz........,aaa,aab,aac.....aaz,............zzz,aaaa...........zzzz..... and so on..
WAP to find out the string value at kth position.
like if k= 28 the string on 28 will be "ab".| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Data Structures - 0of 0 votes
AnswersQ1. F2F Round 1 Amazon(Bangalore)
- Nitin Gupta May 12, 2012 in India
Given a character array as input. Array contains only three types of characters 'R', 'G' and 'B'. Sort the array such that all 'R's comes before 'G's and all 'G's comes before 'B's.
Constraint :- No extra space allowed(except O(1) space like variables) and minimize the time complexity.
You can only traverse the array once.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm Arrays C C# C++ Coding Data Structures Java Sorting - 0of 0 votes
AnswersHow will you count the number of students in a classroom in quickest possible manner.
- Kevin March 13, 2012 in United States| Report Duplicate | Flag | PURGE
Amazon Financial Software Developer Brain Teasers - -1of 0 votes
AnswersHow do you merge n sorted lists with average length K in O(n*log(K)) time?
- ss December 06, 2006| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 1of 1 vote
AnswersA = "ffgggtvshjsdhjfffffffhvjbjcharu"
- SPS March 14, 2017 in India
Find the max consecutive repitative chracter
Output : f -> 7| Report Duplicate | Flag | PURGE
Amazon Testing / Quality Assurance Online Test - 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 - 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
AnswersShopkeeper want sells in the packs of 20,9 and 6. Given an n, you need to find whether its possible to buy the items or not.For example n=21, you can buy 2 packs of 6 and one pack of 9(2*6 + 9)
- prince February 17, 2014 in India
Output 1 if possible and 0 if not
Test cases:
1) n=47 ==> possible, output = 1
2) n=7 ===> not possible, output = 0| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - -1of 1 vote
Answersalgorithm to reverse a singly linked list using one pointer without any additional datastructures
- abhirpnk October 31, 2013 in India| Report Duplicate | Flag | PURGE
Amazon Applications Developer Algorithm - 3of 3 votes
AnswersGiven an array, with positive and negative integers, arrange it in such a way that, positive numbers occupy even positions and negative numbers occupy odd position. All the remaining extra positive or negative integers should be stored at the end of the array. Remember, the elements of the array should remain in the same order.
- technical_123 August 11, 2013 in India
EG: Input array {1,-2,3,-4,-5,-6,-7,8,9,4,10,11,12}
output array {1,-2,3,-4,8,-5,9,-6,4,-7,10,11,12}| Report Duplicate | Flag | PURGE
Amazon Software Analyst - 0of 0 votes
AnswersA stirng is represented using a linked list how will you find if it the string is palindrom.
- rawat011 May 31, 2013 in India| Report Duplicate | Flag | PURGE
Amazon Software Engineer in Test SDE1 Algorithm - 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 - 0of 0 votes
AnswersGiven a list of n gas station of form P(D,X) where D is the distance from this station to next station and X is the amount of petrol available at this station, identify the starting station from where you can complete journey to each station in order from 1.....N. You can only go in one direction i.e from P(i) to P(i+1)
- ravigupt January 26, 2013 in India
EDIT: I forgot to mention that travelling distance K consumes K units of gas.
EDIT2: I proposed an O(n^2) solution, then interviewer asked me if I can do better.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 0of 0 votes
AnswersFind the nodes at d distance from a certain node in a Binary Tree
- popoff January 02, 2013 in India| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 0of 0 votes
AnswersGiven an array of integers. Print a pair whose sum is closest to zero?
- veeru September 07, 2012 in India for Kindle Device
Eg:
Input: arr = {2 5 8 -7 2,9}
Output: => 8, -7| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Arrays - 0of 0 votes
AnswersYou have to count how many binary strings are possible of length "K".
- naveenrai8 August 10, 2012 in India
Constraint: Every 0 has a 1 in its immediate left.
111011 <-- valid
0111 <--- invalid
111100 <-- invalid| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm