Amazon Interview Questions

JAVA PROGRAM TO PERFORM MATRIX MULTIPLICATION

IMPLEMENT SELECTION SORTING IN JAVA

HASHTABLE ITERATOR EXAMPLE

LOOP ARRAY LIST AND ITERATE ARRAY ELEMENTS W ENUMERATING INTERFACE

7. Java Programming examples on “Random Number Generation”

Java Program to Generate N Number of Passwords of Length M Each
Java Program to Generate Date Between Given Range
Java Program to Generate Randomized Sequence of Given Range of Numbers
Java Program to Generate Random Hexadecimal Bytes
Java Program to Generate Tetris Game Using Random Number Generation
Java Program to Create a Random Bitmap Image
Java Program to Emulate N Dice Roller
Java Program to Use rand and srand Functions
Java Program to Implement the linear congruential generator for Pseudo Random Number Generation
Java Program to Generate Random Numbers Using Middle Square Method
Java Program to Generate Random Numbers Using Multiply with Carry Method
Java Program to Generate Random Numbers Using Probability Distribution Function
Java Program to Implement Inversion Method for Random Number Generation
Java Program to Perform Random Number Generation Using Inversion Method
Java Program to Implement Fisher-Yates Algorithm for Array Shuffling
Java Program to Implement Park-Miller Random Number Generation Algorithm
Java Program to Implement Naor-Reingold Pseudo Random Function

Consider that your office provides an app to book meeting rooms. You provide the start and end time of the meeting. The app list the available rooms for that slot and you select a room and confirm your booking. All meeting happen between 9am – 6pm. Write a method for getAvailableRooms(startTime, endTime). Use appropriate data structures.

Top view of a binary tree in constant space

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.

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

Given a decedents of nodes, write an algorithm to find whether it is a tree or a graph?

Find the minimum (index) distance sum of 3 words. For example: arr = {“2”, “1”, “0”, “2”, “0”, “3”, “0”}, input = “1”,”2″,”3″. The result should be 8 since the 2nd “2” and “1”, “3”‘s distance are 3, 1, 5 and abs(3,1)+abs(3,5)+abs(5,1)=8. Implement this in O(N)

Find the frequency of a number in array in less than bigo n time Array 1,2,2,3,4,5,5,5,2 Input 5 Output 3 Array 1,1,1,1, Input 1 Output 4 Keep in mind less than bigo n

Design a system to monitor services (like when they were down/ CPU time) etc.

Design a system for dashboard that effectively shows almost real time data.

Implement Concurrent HashMap class in Java

Implement Linked HashMap class in Java

Design garbage collector in Java

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

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.

Given a set of numbers, find out all subsets of the set such that the sum of all the numbers in the subset is equal to a target number.

s = [ 1, 2, 3, 4, 5 ]
target = 5
op = [ [ 1,4 ] , [2,3] , [5] ]
Application: Given a fixed budget, and work items we are doing back filling to check what all we can attain with the budget.

Continuation. Imagine the set is actually a set of work items, with cost and utility involved :

def work_item : { name : ‘foo bar’ , cost : 10 , utility : 14 }
Now, solve this to maximise utility.

Continuation. Imagine that the work items are related, so that, if work item w1 is already in the
subset of the work items selected, w2 ‘s utility increases further!.
( Can you imagine how it can happen? Effectiveness of Mesi increases when he plays for Barca)
So, you are given a list like this :

w1 -> normal utility 14, with w2 20, ….
Now maximize payoff.
NOTE: Payoff is a matrix. This comes from game theory.
Hence, a payoff matrix looks like :

w1 w2 w3 w4 ….
w1 w1
w2 w2
w3 w3
w4 w4
A cell ( i,j) is filled up with if a list contains both wi and wj, then how much the payoff would be. It is a symmetric matrix.