## Amazon Interview Questions

- 0of 0 votes
Find K which decides the number of open brackets are equal to the number of closed brackets.

input : (())

output : 2

Reason : if we divide the string at 2nd position, we get two open brackets and two closing brackets, and they are same .

input : (())))(

output : 4

Reason : if we divide the string(not necessarily equally) at 4rth position, we have (()) on the left side and on the right side we have ))( , as you can see, on the left half, we have two opening brackets and on the right half we have two closing brackets and they are equal .

input : ))

output : 2

Reason : there is no open brackets , so if we divide taking the whole string's length, we have )) on the left half and nothing on the right half. Now you can see that on the left half there is no open brackets and on the right half there is no closed brackets.

This question should be clear by now and remember you have to find out that K .

- -2of 2 votes
Fill the arrray with elements from 0 to 9.

based on thier frequency.

a[1]=3 means, 1 is repeated for 3 times(1 must present 3 times in that array)

a[2]=4 means 2 is repeated for 4 times.(2 must present twice in that array)

- 0of 0 votes
Find the Maximum number of distinct nodes in a binary tree path

- 0of 0 votes
Write test cases to test a browser App

- 0of 0 votes
A = "ffgggtvshjsdhjfffffffhvjbjcharu"

Find the max consecutive repitative chracter

Output : f -> 7

- 0of 0 votes
A = {1,2,4,-6,5,7,9,....}

B = {3, 6, 3, 4, 0 .......}

n = 5 -> pairs whose sum is n

Output = (1,4), (5,0)....

- 0of 0 votes
find the given Binary tree is mirrored tree or not

should be like

60

/ \

30 30

/ \ / \

20 50 50 20

- 0of 0 votes
Given a BST (Binary Search Tree) , Each node value should replace with sum of the node which are greater-than the given node.

conditions :

No Extra space / variable can use

Modify the existing tree in optimal way.

- 0of 0 votes
Design a system having multiple jobs, interacting with each other such that :

1) A job can run for very long periods (1-2 days)

2) A node can fail/crash on which certain job is running

system should be scalable

3) Amount of data getting transferred is huge

4) Data in the system is very sensitive and needs security

job/s can fail

- 0of 0 votes
Top View of a Binary Tree in constant space

- 0of 0 votes
Given a pattern containing only Is and Ds. I for increasing and D for decreasing. Devise an algorithm to print the MINIMUM number following that pattern. Digits from 1-9 and digits can’t repeat.

Example:

1. Input: D Output: 21

2. Input: I Output: 12

3. Input: DD Output: 321

4. Input: II Output: 123

5. Input: DIDI Output: 21435

6. Input: IIDDD Output: 126543

7. Input: DDIDDIID Output: 321654798

- 0of 0 votes
Implement ConcurrentHashMap class in Java

- 0of 0 votes
Implement LinkedHashMap class in Java

- 0of 0 votes
You have been given a grid with some doors, walls and some empty spaces.

1st part : You have to tell the least no of moves to go from random position in the grid to the nearest door. You can move in four directions only, i.e, left, right, above, below.

2nd part : Least distance of every empty cell to the nearest door. Lots of discussion was done on both the parts of the problem.

- 0of 0 votes
Design garbage collector in Java

- 0of 0 votes
Maximum triangle path Sum : Starting from the top of a pyramid of numbers like below, you can walk down going one step on the right or on the left, until you reach the bottom row:

55

94 48

95 30 96

77 71 26 67

One of such walks is 55 -> 94 >- 30 -> 26. You can compute the total of the numbers you have seen in such walk, in this case it’s 205.

Your problem is to find the maximum total among all possible paths from the top to the bottom row of the triangle. In the little example above it’s 321.

- 0of 0 votes
Design a online shipment tracking system.

- -1of 1 vote
Design a system to upload images and tag them. Ability to search images with single and multiple tags.

- 0of 0 votes
Given a very large binary number which cannot be stored in a variable, determine the remainder of the decimal equivalent of the binary number when divided by 3. Generalize to find the remainder for any number k.

- 0of 0 votes
Given a file having many lines of text(words) and given a dictionary having an API function boolean isValid(String word), which will return true is a word passed to this function is valid word in dic.,and will return false if given passed argument is not a valid word in dic.

Now read the file and check if each word as well as all possible words from its L to R and R to L combinations, are valid words in dic. or not.

- 0of 0 votes
Given sequentially placed boxes, each representing a number( which may be positive or negative), we need to select the numbers in order to have the maximum sum, having the constraint that if we select a given box, we cannot select adjacent box to it, but can select any other.

- 0of 0 votes
Given 2 integers, add them without using any arithmetic operator

- 0of 0 votes
Implement a LRU cache with ttl at each block

- 0of 0 votes
Given some resources in the form of linked list you have to delete all the resources which sum up to 0(Zero) and return the remaining list.

- 0of 0 votes
Find all anagrams of a given string in a file of size 1TB.

- 0of 0 votes
Given two strings print all possible permutations of two strings such that the order of characters are maintained.

- 0of 0 votes
Given an array,generate all valid ip address from the array.

- 0of 0 votes
Find Longest Repeated Substring in the given string.

- 0of 0 votes
Table: Student

Fields: Student_ID, Department, Start_Date

ex: 1,A, 2017-01-1

1,B, 2017-07-1

1,C, 2017-12-1

Expected Output: Student_ID, Department, Start_Date, End_Date

ex: 1,A, 2017-01-1, 2017-07-01

1,B, 2017-07-1,2017-12-01

1,C, 2017-12-1, ...

End_Date is the start Date of the next record for the student ID

- 0of 0 votes
Given a equi-weighted uni directed graph and need to find the max distance possible from a given node.