Sample Questions for Amazon Interview (Part - II)

Leave a Comment
Check these tooPart - I>>   Part - III>>   Part - IV>>

1. There is a postal code scheme with 3 characters:
A0A
A0B
.
.
.
.
A0Z
A1A
A1B
.
.
.
   You will be given 2 postal codes and you have to print all the postal codes in betwwen those 2 codes.

2. Given 2 binary trees checkif they are mirror images of each other.
int isMirror(Tree *BST1, Tree *BST2);

3. Find middlemost element of a linklist(Not in sorted order).
Eg. 1->5->3->4->6->9
Ans: 3.

4. There is an array with all elements repeating odd number of times and only one element
   repeating even numbr of times.
Find the element which repeats even number of times.

5. Find all  pythagorean  tripletes in a given array of integers.

6. There is a link-list having structure
struct LinkList{
struct LinkList *next, *sortedNext;
int data;
}
Initially  sorted Next pointer points to null and next points
to the next pointer as in simple link list.
Manipulate the pointers such that sortedNext pointer of each
node points to the sorted-next node
(It´s the first node in
right side when link-list is sorted).

7.Given A a nxn matrix. Write a function which will multiple A to itself k times (k>0).
int **power(int **,int k);

8. Given 2 sorted arrays of same size, find the median of the combined array
in sorted array without merging
the 2 arrays.
Eg: array1: 1, 3, 4, 5, 10
    array2: 2, 3, 8, 9, 11
Ans:- 4.

9. Given a linked list, remove all elements from the list which occur more than once.
Eg:
3->2->5->2->1->3->7.
Resultant Linked list: 5->1->7.

10. Given an array find the largest sum of any k numbers.

11. There is an array elements of which are in increasing order till some point after which they are decreasing order.
Find the maximum element of this array.
Eg:- 1, 2, 3, 5, 4, 0.
Ans:- 5.

12. Given an array find the first repeating element in the array.
Eg:- 1, 2, 4, 3, 3, 4.
Ans:- 4.

0 comments:

Post a Comment