Recent Interview Questions
- 0of 0 votes
AnswersGiven a set of numbers eg:{2,3,6,7,8} . any one who is playing the game can score points only from this set using the numbers in that set. given a number, print all the possible ways of scoring that many points. Repetition of combinations are not allowed.
- putta.sreenivas May 09, 2011
eg:
1. 6 points can be scored as
6
3+3
2+2+2
2. 7 can be scored as
7
2+2+3
but 2+3+2 and 3+2+2 is not allowed as they are repetitions of 2+2+3| Report Duplicate | Flag | PURGE
Amazon Developer Program Engineer Algorithm - 0of 0 votes
Answers<round 3>
- siva.sai.2020 February 08, 2011
9. Array A[n] it contains numbers from 1 to n but 1 number repeated. Find out missing number.
----------------------
I have not answered this question and manager not happy with my performance. THIS THE END OF THE BATTLE.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Data Structures - 0of 0 votes
AnswersFind no. of days between Jan1st and entered date (See question posted by Troy on Oct 7 2010)
- Guest December 06, 2010| Report Duplicate | Flag | PURGE
Epic Systems Software Engineer / Developer Algorithm Coding - 0of 0 votes
AnswersIf a number is power of 2
- Interviewee October 07, 2010| Report Duplicate | Flag | PURGE
Qualcomm Software Engineer in Test Bit Manipulation - 1of 1 vote
AnswersThere is very long array of ints, and you are given pointer to base addr of this array.. each int is 16bit representation... you need to return the pointer to tht "bit" inside array where longest sequence of "1"s start
- gradStudent June 16, 2010| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm Arrays Bit Manipulation Computer Architecture & Low Level - 0of 0 votes
AnswersGiven a two integer n and d. Print the value of n/d. When n/d may or may not have decimal digits. In case of numbers n=1 and d=3, n/d=0.3333333.... So when there is a repeating pattern the output should be 0.(3), In case of a n/d = 3.12454545454545.... the output should be 3.12(45), for n/d = 4.123982 the output should be 4.123982. Give a solution and write code for the same.
- Raju April 21, 2010| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 0of 0 votes
AnswersGiven a singly linked list, swap every two elements (e.g. a->b->c->d->e->f->null should become b->a->d->c->f->e->null). Code it such that memory position is swapped and not the node value.
- AnonymousUser March 28, 2010| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Linked Lists - 0of 0 votes
AnswersSuppose you are given a dictionary of words based on an alphabet with a fixed number of characters. Please write a method / function which will find the longest word in the dictionary such that it can be built from successively adding a single character to an existing word in the dictionary (in any location). For instance, "a" -> "at" -> "cat" -> "chat" -> "chart".
- Anon March 24, 2010| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - 0of 0 votes
AnswersConvert a binary search tree to a sorted doubly linked list
- Anonymous December 20, 2009
inplace.| Report Duplicate | Flag | PURGE
Adobe Microsoft Software Engineer / Developer Data Structures Trees and Graphs - 0of 0 votes
AnswersFind the K'th Maximum Element in a Binary Search Tree . Do it in O(log N).
- Amar August 31, 2009
Please dont do a in order tree traversal and return the K'th element from the end. I told that but interviewer did not wanted me to traverse the entire tree. Any suggestions ?| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 0of 0 votes
AnswersWrite a code to swap every two bits in a byte. (Using bit operators) eg: Input: 10 01 11 00 Output: 01 10 11 00
- jai August 11, 2009| Report Duplicate | Flag | PURGE
Cisco Systems Bit Manipulation - 1of 1 vote
AnswersThere is a security keypad at the entrance of a building. It has 9 numbers 1 - 9 in a 3x3 matrix format.
- SHA.AN March 04, 2009
1 2 3
4 5 6
7 8 9
The security has decided to allow one digit error for a person but that digit should be horizontal or vertical. Example: for 5 the user is allowed to enter 2, 4, 6, 8 or for 4 the user is allowed to enter 1, 5, 7.
IF the security code to enter is 1478 and if the user enters 1178 he should be allowed.
Write a function to take security code from the user and print out if he should be allowed or not| Report Duplicate | Flag | PURGE
Epic Systems Software Engineer / Developer Coding - 1of 0 votes
AnswersThere are two linked lists which converge at one point. Return the 1st node at which they converge
[__]-->[__]-->[__]--> [__]-->[__] [__]-->
Hope my diagram is understandable
- Anonymous February 11, 2009| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Software Engineer in Test Linked Lists - 5of 5 votes
AnswersHad my first and second phone interview with Amazon. I was dropped. This site has been a great help towards my preparation and most questions are based on what you find here.
- S July 01, 2008
Posting my Questions is a small way of saying Thanks!
Interview 1:
1. What is polymorphism.
2. Design an OO parking lot. What classes and functions will it have. It should say, full, empty and also be able to find spot for Valet parking. The lot has 3 different types of parking: regular, handicapped and compact.
3. Coding: I have an integer array where every number appears even number of times and only one appears odd times. Find the number.
(I said hashtable and he asked me to write code with Hashtable)
4. What data structure would you use to look up phone numbers for customer names.
(I said Hashtable. Asked why hashtable, why not a tree. I said HT has O(1). Asked is order always 1, when more than O(1) in HT.
Second Interview:
1. Starter: Describe your college projects.
2. OO Design: Design a deck of cards. What classes, data structures will you use? How will you shuffle the cards? How will you divide (deck) among players. What class/function do you need to denote players and where will you add them? What class/function do you need to deck? What if I need to add 2 jokers to the deck of 52 cards.
3. Data Structures: How will you use a hashtable to find data in a tree. (Then he rephrased) suppose I have a hashtable, I want to store the data in a tree instead of a bucket. How will I do it. What complexity to find an element.
4. Bits & Bytes: Find if a binary representation of a number is palindrome. The function should work irrespective of number of bytes for an integer. Suppose if our machine is 4 bytes for an int, how will you use the program for 8 byte machine.
5. Unix: Suppose I have 100's of html files in many directories. I want to find the files having phone numbers.
b) Suppose I have 2 files having phone numbers, find the repeating phone numbers. (I said sort and grep). Then he asked what if the lines cannot be sorted.
All the best guys. I think the second interview was challenging since the interviewer was prodding until he heard a leave me alone. So it means that though they are based on questions in cc, be prepared for extensions. I think this site is all you need to prepare for Amazon interview.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Java Data Structures Object Oriented Design Coding - 1of 1 vote
AnswersGiven a N*N chess board, a robot starts from the left-up corner and ends at right-down corner. It can only move one cell per time and the direction must be right or down.
- crazystone April 10, 2008
Give the algorithm that count all possible paths.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 0 votes
Answers5 6 7 8 8 8 8 8 ? What is the next number in the series ???
- vas November 15, 2007| Report Duplicate | Flag | PURGE
Goldman Sachs Software Engineer / Developer Brain Teasers - 0of 0 votes
Answersgiven a integer, output its previous and next neighbor number which has the same number of bit 1 in their binary representation.
- AK47 November 08, 2007| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Math & Computation Data Structures Coding Algorithm - 0of 0 votes
AnswersDescribe in english what this code do?
- vodangkhoa February 04, 2006
( (n & (n-1)) == 0)| Report Duplicate | Flag | PURGE
NVIDIA Software Engineer / Developer Terminology & Trivia - 0of 0 votes
AnswersDesign an algorithm to find duplicates in an array. Discuss different approaches.
- divya November 19, 2005| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm - 1of 1 vote
AnswersGiven a list L of video names and their watch rates, write a function that will return the videos with the top 10 watch rates. Video names may appear more than once.
- neer.1304 July 03, 2019 in United States
Example:
L = [(‘abc’, 10), (‘def’, 15), (‘ghi’, 10), (‘abc’, 12), …, (‘xyz’, 100)]
The function should return [‘xyz’, ‘abc’, …, ‘def’, ‘ghi’]| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - 4of 4 votes
AnswersGiven arrays for N (>= 2) users, each representing the IDs of hotels visited, find the common IDs of the hotels visited amongst the users.
- PraTrick April 26, 2017 in India
Input:
userA = { 2, 3, 1 }
userB = { 2, 5, 3 }
userC = { 7, 3, 1 }
Output:
{3}
Assumptions:
Arrays are unsorted.
Cases:
1) Each array consists of distinct hotel IDs
2) Each array may contain duplicate hotel IDs| Report Duplicate | Flag | PURGE
Booking.com Software Engineer / Developer - 2of 2 votes
AnswersWrite a method to count the number of 2s between 0 and n.*
- xankar May 12, 2016 in United States| Report Duplicate | Flag | PURGE
Amazon Software Developer Coding - 1of 1 vote
AnswersGiven a string S, print the longest substring P such that P > S lexicographically.
- emb March 16, 2016 in United States
You may assume that such substring exists.| Report Duplicate | Flag | PURGE
Google Software Engineer Algorithm - 0of 0 votes
AnswersGiven a set of ranges:
- effy November 02, 2015 in United States
(e.g. S = {(1, 4), (30, 40), (20, 91) ,(8, 10), (6, 7), (3, 9), (9, 12), (11, 14)}.
And given a target range R (e.g. R = (3, 13) - meaning the range going from 3 to 13). Write an algorithm to find the smallest set of ranges that covers your target range. All of the ranges in the set must overlap in order to be considered as spanning the entire target range. (In this example, the answer would be {(3, 9), (9, 12), (11, 14)}.| Report Duplicate | Flag | PURGE
Facebook - 2of 2 votes
AnswersFind how many numbers of length n are there such that each number is at least 4 smaller/greater than the number before and after it.
- coolProgrammer August 02, 2015 in United States
Eg: if n = 5, such numbers are 39518, 15951, etc.| Report Duplicate | Flag | PURGE
Google Software Developer Dynamic Programming - 1of 1 vote
AnswersReverse string except spaces. A string has mix of alphabets and spaces. Your task is to reverse the string, but preserve the positions of spaces. For example, reverse of " a if" is " f ia".
- sg July 22, 2015 in United States| Report Duplicate | Flag | PURGE
Microsoft Software Engineer Algorithm