Leave your Email to get the latest Amazon interview questions weekly.
We'll never share your email with anyone else.
No spam we promise.
Design instagram auction system, both static and live...
Design Online Chess Game...
Design the theme and style marketplace, for example on Atlassian, where you can buy themes for your Atlassian products...
Design an Online Auction website where bidders can bid online against each other for contracts against a published item specification…
Design the smart lock system...
How to use Queues in your system?
Design a scalable weather data service for your customers...
Implement a rate limiter. Complete the following class...
Given an array bulb where bulb[i] is the wattage of the ith bulb and an integer k, return the minimum total wattage of the bulbs after k contiguous bulbs are removed...
Design a version control system like GitHub…
Given a task pipeline that will process one task at a time, and two types of task are supported, the main task and the side task, return the final state after all tasks are processed. Note no extra memory is allowed...
Get the count of N-bit binary number with no consecutive set bits...
Design a chat app like FB Messenger/Whatsapp/Slack and search the chat history by keywords…
Design the playlist sharing feature on Spotify...
Design a file sharing app like Google Drive/Dropbox/Box…
Given N stocks with ratings, develop an algorithm that will suggest combinations of stocks the investor might buy...
Given two unsorted arrays, return the number of pairs from both arrays with sum equals to S. Also we need to provide a function to update the arrays...
Design the user autocomplete model in the google search bar....
Given the server log as a json string, decode the json string and return the most popular pages in the past 7 days, 30days, 1year...
Given a list of molecules, return the distance between the closest pair...
Given an integer array, split the array into 2 subarrays, subarray1 and subarray2 such that sum(subarray1) >= sum(subarray2). Return the number of such splits...
Given an integer array, split the array into 2 subarrays, subarray1 and subarray2, which meets the following constraints...
Given N cargos and N piles of items, return the maximum number of fully loaded cargos...
You have a secret array. You also have two integers upperbound and lowerbound. Now you need to return how many arrays exist within the upperbound and lowerbound that analogy to your secret array...
Given a singly linked list, two pointers are moving on it. Pointer1 is moving from head to tail. Pointer2 is moving from tail to head. The two pointers moving at the same speed. Return the maximum sum of the two pointers...
Given a string of English letters, compress the repeating characters in it, and then decompress it...
Given a list of products, and a product priority sequence, return the length of the shortest product sublist that satisfies the priority sequence...
Given a list of file names in a system, write a program to rename the duplicate files...
Given an undirected graph, find out all the vertices when removed will make the graph disconnected...
Given a graph with node from 1 to n, and a list of integer pairs represent edges, return all the bridges...
Given an integer floor and an integer ceil, and a list of holes, find the length of the longest consecutive integers...
Given a list of products, and a product priority sequence, check if the input satisfies the priority sequence...
Given a cache and a list of incoming queries, return the cache hit ratio.
Build an array by values within the range from LowerBound to UpperBound...
Reduce all prices in the input text by 25%. Round to the nearest cent...
Given an M * N matrix, where matrix[i][j] is the height of the block on position (i, j). Each block has 4 neighbors - the blocks at its top, bottom, left and right. A sink area is a group of neighboring blocks that are fully surrounded by other blocks with greater heights. When water is poured onto the matrix, the sink area traps the water in it. Build a function that finds the number of blocks in the maximum sink area...
Find a pair of entries from two lists that yield a sum that is as close to a target number as possible, without exceeding it...
Design the simple search function for products on Amazon...
Given a string str and an integer k, you need to rearrange the string in a way that the same characters must be at least k distance away. If not possible, return "".
Example:
Input:
str = "aabb", k = 2
Output:
You can return either "abab" or "baba".
Given a BST, and an integer k, cut the BST vertically into two substrees A and B, where all nodes in A <= k and all nodes in B > k.
Contrain: for any node A and it’s parent B in the original BST. If after the cut they are both in the same subtree. B should still be the parent of A.
Given a binary tree and a list of nodes say [n1, n2, .. nk], write a program to find the least common ancestor.
...
You are given a huge number of IPs in a list. Remove all duplicated addresses from the list.
Two people from different teams will work together on a project that requires a total of T hours. Each team is represented as an N-ary tree where a tree node is a team member and the number of hour(s) the member can devote to the project. Find out all the unique combinations of hours that both people's work [t1, t2] add up to T hours...
Input: a list of filenames with paths You need to complete the following class to support linux find command.
You are on a flight and want to watch two movies during this flight. You need to pick two movies and the total duration of the two movies is less than or equal to d.
Find out all broken connections in the data center...
Given k days and array P as the item sizes, find out the minimum total container size required to move all the items...
Design an class to generate unique ID for new users.
Given a 2D grid, each cell is either a zombie or a human. Zombies can turn adjacent (up/down/left/right) human beings into zombies every day. Find out how many days does it take to infect all humans?
A queue of people are waiting to buy ice cream from you.
Each person buys one ice cream, which sells for $5.
Each customer is holding a bill of $5, $10 or $20.
Your initial balance is 0.
Find whether you will be able to make change for every customer in the queue. You must serve customers in the order they come in.
Design and implement the Least Recently Used Cache with TTL(Time To Live)
Expalnation on the eviction stragedy since people have questions on the testcase:
1, after the record expires, it still remains in the cache.
2, when the cache reaches the capacity, it first evicts the expried records. If there are more than one expired records, evict the one with the minimum expire timestamp.
...
You can find a word in 2d array if the word is constructed by a sequence of adjacent letters
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.
Given an ArrayList of Nodes, with each Node having an ID and a parent ID, determine whether the List is given in preorder.
Phone Interview Amazon, Seattle
I. Get the sum of all prime numbers up to N. primeSum(N).
Follow-up: If primeSum(N) is frequently called, how to optimize it.
II. OODesign Parking Lot
AWS phone interview
Find the left view of binary tree
1
/ \
2 3
/\ \
4 5 6
/ /
7 8
/
9
return [1, 2, 4, 7, 9]
Find the indices of all anagrams of a given word in a another word.
For example: Find the indices of all the anagrams of AB in ABCDBACDAB
(Answer: 0, 4, 8)
Give a binary tree, find if it's possible to cut the tree into two halves of equal sum. You can only cut one edge.
For example, UNIQ("LETTER") = 2.
Given a string S with only uppercases, calculate the sum of UNIQ(substring) over all non-empty substrings of S.
If there are two or more equal substrings at different positions in S, we consider them different. Since the answer can be very large, retrun the answer modulo 10 ^ 9 7.Given a binary tree, find the closest LEAF node to the target.