0% found this document useful (0 votes)
133 views2 pages

Amazon Technical Paper

The document contains interview questions about algorithms, data structures, Java concepts, OOP concepts and problem solving. Some example questions are to check if a string is a composite of two dictionary words, find the next higher number without consecutive 1s in binary, find the missing number in a range, and distribute balls among containers to maximize probability of a red ball.

Uploaded by

Ankita
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
133 views2 pages

Amazon Technical Paper

The document contains interview questions about algorithms, data structures, Java concepts, OOP concepts and problem solving. Some example questions are to check if a string is a composite of two dictionary words, find the next higher number without consecutive 1s in binary, find the missing number in a range, and distribute balls among containers to maximize probability of a red ball.

Uploaded by

Ankita
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Amazon Interview Questions

1. Given a dictionary with limited words. Check if the string given to you is a composite of two
words which are already present in the dictionary.
2. Is {a, n, d} a palindrome ? If you are given a random string, is it a palindrome or not?
3. What is the function of the 'finally' block in Java? Under what conditions does the finally block
not get executed, if this is possible?
4. Given a binary search tree. Traverse only the left sub-tree.
5. Generate the following pattern when x is given upto Nth terms

For ex:

Input: x=2 ,N=5

OUTPUT:

12

1112

3112

132112

6. Display all the nodes at the same level in a tree.


7. Write a C program that, given an array A[] of n numbers and another number x,
determines whether or not there exist two elements in S whose sum is exactly x.
8. Write an efficient program for printing k largest elements in an array. Elements in
array can be in any order.
9. Find the next higher no. Of x Whose binary represent does not contain consecutive
1s-

For ex:

Input: 12

Output: 16

10. Implementation of AVL tree.


11. Define Data Abstraction. What is its importance?
12. What is the time and space complexities of merge sort and when is it preferred over quick
sort?
13. Given a string,find the first un-repeated character in it? Give some test cases
14. What are the 4 basics of OOP?
15. What is the time and space complexities of merge sort and when is it preferred over quick
sort?

16. Write a function which takes as parameters one regular expression(only ? and * are the
special characters) and a string and returns whether the string matched the regular
expression.
17. Given n red balls and m blue balls and some containers, how would you distribute those
balls among the containers such that the probability of picking a red ball is maximized,
assuming that the user randomly chooses a container and then randomly picks a ball from
that.
18. Find the second largest element in an array with minimum no of comparisons and give the
minimum no of comparisons needed on an array of size N to do the same.
19. Given an array of size n, containing every element from 1 to n+1, except one. Find the
missing element.
20. How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do
the same
21. Given an array of size n. It contains numbers in the range 1 to n. Each number is present at
least once except for 1 number. Find the missing number.
22. Explain polymorphism. Provide an example.
23. Given an array all of whose elements are positive numbers, find the maximum sum of a
subsequence with the constraint that no 2 numbers in the sequence should be adjacent in
the array. So 3 2 7 10 should return 13 (sum of 3 and 10) or 3 2 5 10 7 should return 15
(sum of 3, 5 and 7)
24. You are given some denominations of coins in an array (int denom[])and infinite supply of all
of them. Given an amount (int amount), find the minimum number of coins required to get the
exact amount. What is the method called?

You might also like