## Amazon Interview Questions

- 0of 0 votes
Design the architecture for advertisement platform where N number of advertiser can display their ad on M number of websites.

- 0of 0 votes
Find the given doubly linked list is palindrome or not.

- 0of 0 votes
Design a system for implementation of stock market.

Buyer and seller case. stock server will receive buy request and sell request. A sell can be successful when it matches the quantity and price for same stock.

There will be many request for buyer and seller . Need to select the appropriate one.

Which data structure will be used ? how to handle concurrency issue?class diagram?

- 0of 0 votes
Given an array arr and a number n, you have to find whether there exist a subset in arr whose sum is n. You have to print length of the subset.

1. There exists only one subset like that

2. All number in arr are positive

- 0of 0 votes
list1 -->aaa,bbb,ddd,xyxz,...

list2-->bbb,ccc,ccc,hkp,..

list3> ddd,eee,,ffff,lmn,..

Inside a list the words are sorted

I want to remove words which are repeated across the list and print in sorted order

If the words are repeated in same list its valid.

In the above case

it should print aaa-->ccc-->ccc-->eee--->fff-->glk-->hkp-->lmn-->xyxz

- 0of 0 votes
Write a program to compress a string and send it a over a network and decompress it on the receivers end

- 0of 0 votes
Some questions about how to write a immutable class.

- 0of 0 votes
Find top n cities which got most orders. For example, amazon got a list of orders, and these orders will be shipped to different cities.

- 0of 0 votes
I have a file which has a number of 10 digit numerals and 10 digit alphanumeric characters. Write a UNIX basic command to print distinct 10 digit alphanumeric charters

Sample Input

1234567890

1234567890

123456789X

0974385495

Expected O/P

123456789X

- 0of 0 votes
Delete files of size more than 100mb in a folder which are older than 90 days.

- 0of 0 votes
Given a comma separated file print the last but one column of every line.

e.g:

a,b,c,d,e,f

1,2,3,4

w,x,y,z

output should be

e

3

y

- 0of 0 votes
A binary tree and a number, say k are given. Print every path in the tree with sum of the nodes in the path as k.(A path can start from any node and end at any node, i.e. they need not be root node and leaf node; and negative numbers can also be there in the tree)

- 0of 0 votes
Design Amazon Recommendations Feature. Focus on designing how would you store and make it accessible fast? What would be class design like for the class which would provide list of products which people bought similar to a given product? How would you test that class?

- 0of 0 votes
LinkedList Reverse

- 1of 1 vote
Write a program to reveres string from intervals

- 0of 0 votes
Write a iterator wrapper to remove duplicates from collections without using temporary storage.

For Example:

ArrayList A = {RAT,CAT,BAT}

ArrayList B = {RAT,CAT,MAT}

ResultIterator itr = new ResultIterator();

itr.next() should display {RAT,CAT,BAT,MAT}

Program skeleton:

class ResultIterator {

ResultIterator(iterator itr1, iterator itr2) {

}

bool hasnext {

// implement this method

}

E next() {

// implement this method

}

}

- 2of 2 votes
Q: If you were given a series of equations e.g. [A = B, B = D, C = D, F = G, E = H, H = C]

and then another series [A != C, D != H, ..., F != A ]

Check whether the equations combined is valid.

For the example given, your program should return 'invalid', because the first series implies that A = C, which contradicts the statement A != C in the second series.

- 0of 0 votes
Given two sorted arrays A and B that may have repeated elements. Form a new sorted array C that contains the elements of A and B [Condition : You are not allowed to merge the two arrays and then sort. ]

- 0of 0 votes
Given an array , find the element (say X) that has all the elements less that it to its left side and all the elements greater to it on its right side.

The left and right elements of X need not be in sorted form.

- 1of 1 vote
Find the maximum consecutive 1's in an array of 0's and 1's.

Example:

a) 00110001001110 - Output :3 [Max num of consecutive 1's is 3]

b) 1000010001 - Output :1 [Max num of consecutive 1's is 1]

- 0of 0 votes
Write test cases on Whatsapp group chat

- 0of 0 votes
You are given an array of integers. Find the minimum difference between two prime numbers(Positive or negative) in the array when present with minimum time complexity and provide the test data to test the this code.

- 0of 0 votes
Give a large multi MB byte file in memory, a system handles delete requests for segments typically of the order of bytes. The system has a constraint that individual purge requests of byte segments are expensive, so that the no. of purges are a minimum.

Eg. a 5 MB file receives delete requests for offsets (1, 100), (250, 550),(1000, 1200), (400, 600), (800, 900), (1100, 1150)

Effective delete requests - (1, 100) , (250, 600), (800, 900), (1000, 1200)

The users of the system always go by the absolute byte ordering of the file. Eg. if byte 1 is deleted, the users of the system will reference the actual byte 2 as byte 2.

What data structure would you use to store these intervals such that the following operations are efficient 1. Looking up an interval 2. Inserting a new interval that has no overlap with existing ones 3. Inserting a new interval that has partial overlaps with existing intervals. This would involve collapsing the existing intervals with the new interval to form a single large interval. Eg. Interval cache: {(1, 100), (250, 550), (1000, 1200)} , new interval : (400, 700) -> Interval cache: {(1,100), (250, 700), (1000, 1200)}

- 0of 0 votes
How to verify the string which contains alpha-bates,parenthesis and signglle/double quote

Ex: AB(CD{"GH"}) is valid

"A()B' is invalid

- 0of 0 votes
Implement Java Set using TDD

- 0of 0 votes
Given an mXn Sorted matrix and a value X. Every row is sorted and first number of every row is greater than last number of previous row Find the value X in most efficient way.

- 2of 2 votes
Given a Binary tree and value X. Find X in the tree and return its parent

X:

10

4 3

5 7 9 8

If X = 7, return 4

- 1of 1 vote
Remove 3 consecutive duplicates from string.

INPUT:aabbbaccddddc

OUTPUT:cdc

- 1of 1 vote
Randomly select one of the weighted items from a linked list. (you may only go through the list once)

e.g.

weight 1.6 -> weight 0.2-> ... -> weight 3.4

randomly select one item based on the weight. The higher the weight is, the more likely to be selected

- 1of 1 vote
Given two strings needle and haywards that contains ASCII characters,write an algorithm to output a list of 0-based indices of the occurances of all anagrams of needle in haystacks