Leave your Email to get the latest Amazon interview questions weekly. No spam we promise.
Write an algorithm that identifies the top N toys out of a list of quotes and list of toys...
Your server has received a package of N incoming requests. Handling the K-th request (for K from 0 to N − 1) will take A[K] seconds...
Design a data structure to return the next word in the dictionary...
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 "".
Implement the following class to keep track of the first unique number in a data stream.
Given a two 2D integer array, find the max score of a path from the upper left corner to bottom right corner. The score of a path is the minimum value in that path.
Given a two 2D integer array, find the max score of a path from the upper left corner to bottom right corner. The score of a path is the minimum value in that path.
Given a M-ary tree, find the subtree with maximum average. Return the root of the subtree.
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.
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.
Design and implement the Least Recently Used Cache with TTL(Time To Live)
A group of friends decide to meetup on a chosen date. Everyone in the group provides...
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.
Give m balls and n bins. Find out how many ways to assign balls to bins. Notice the buckets has no order. Like (1,2,3) and (3,2,1) are considered the same.
eg, m = 3, n = 2, return 2. (1, 2) and (3, 0)
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]Given an ArrayList of Nodes, with each Node having an ID and a parent ID, determine whether the List is given in preorder.
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)
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
Given a binary tree, find the closest LEAF node to the target.
Amazon On-site in Seattle
Every round has behavioral questions followed by tech questions.
1st Round: by interviewer and a shadow.
Question: Compare two calendar dates (There is only Year/Month/Day in the given date stamp). It is a simple question but you’ll need to dig for further information from the discussion with interviewer.
2nd Round: by hiring manager.
Question: Design parking lot. The interviewer asked me to draw the block diagram to show relations among objects.
3rd Round: by an interviewer
Question: Assume that a video service calls a function every time someone watches a video. Build a function that returns the n most viewed videos an hour ago till now.
4th Round : by interviewer and a shadow.
......
Amazon On-site Seattle AD Team SDE I
Interviewee is a new graduate, Master’s Degree in Computer Science.
Location: on-site Seattle
Team: Amazon AD
Position: SDE1
There are four rounds in total from 9.30am to 12.45pm. The schedule is pretty intense as there was only one 10 minutes break. The third round was a big challenge for me.
...
Second Round On-site Interview with Amazon
1st Question reorder linked list in this way
Given x1 -> x2 ->x3…-> y3 -> y2 -> y1
Reorder it to x1 -> y1 -> x2 -> y2 -> x3 -> y3
…..
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.
LeetCode
167 Two Sum II - Input array is sorted Easy
78 Subsets Medium
89 Gray Code Medium
199 Binary Tree Right Side View Medium
23 Merge k Sorted Lists Hard
200 Number of Islands Medium
5 Longest Palindromic Substring Medium
8 String to Integer (atoi) Medium
49 Group Anagrams Medium
98 Validate Binary Search Tree Medium
102 Binary Tree Level Order Traversal Medium
48 Rotate Image Medium
236 Lowest Common Ancestor of a Binary Tree Medium
240 Search a 2D Matrix II Medium
239 Sliding Window Maximum Hard
121 Best Time to Buy and Sell Stock Easy
234 Palindrome Linked List Easy
238 Product of Array Except Self Medium
204 Count Primes Easy
235 Lowest Common Ancestor of a Binary Search Tree Easy
297 Serialize and Deserialize Binary Tree Hard
186 Reverse Words in a String II Medium
160 Intersection of Two Linked Lists Easy
20 Valid Parentheses Easy
138 Copy List with Random Pointer Medium
42 Trapping Rain Water Hard
141 Linked List Cycle Easy
127 Word Ladder Medium
242 Valid Anagram Easy
126 Word Ladder II Hard
215 Kth Largest Element in an Array Medium
139 Word Break Medium
21 Merge Two Sorted Lists Easy
2 Add Two Numbers Medium
206 Reverse Linked List Easy
3 Longest Substring Without Repeating Characters Medium
15 3Sum Medium
146 LRU Cache Hard
17 Letter Combinations of a Phone Number Medium
1 Two Sum Easy
155 Min Stack Easy
355 Design Twitter Medium
380 Insert Delete GetRandom O(1) Medium
396 Rotate Function Medium
387 First Unique Character in a String Easy
414 Third Maximum Number Easy
73 Set Matrix Zeroes Medium
438 Find All Anagrams in a String Easy
119 Pascal's Triangle II Easy
451 Sort Characters By Frequency Medium
449 Serialize and Deserialize BST Medium
459 Repeated Substring Pattern Easy
460 LFU Cache Hard
508 Most Frequent Subtree Sum Medium
516 Longest Palindromic Subsequence Medium
517 Super Washing Machines Hard
529 Minesweeper Medium
532 K-diff Pairs in an Array Easy
535 Encode and Decode TinyURL Medium
536 Construct Binary Tree from String Medium
538 Convert BST to Greater Tree Easy
537 Complex Number Multiplication Medium
545 Boundary of Binary Tree Medium
553 Optimal Division Medium
579 Find Cumulative Salary of an Employee Hard
606 Construct String from Binary Tree Easy
617 Merge Two Binary Trees Easy
640 Solve the Equation Medium
645 Set Mismatch Easy
646 Maximum Length of Pair Chain Medium
661 Image Smoother Easy
662 Maximum Width of Binary Tree Medium
663 Equal Tree Partition Medium
675 Cut Off Trees for Golf Event Hard
682 Baseball Game Easy
694 Number of Distinct Islands Medium
692 Top K Frequent Words Medium
711 Number of Distinct Islands II Hard
189 Rotate Array Easy
725 Split Linked List in Parts Medium
738 Monotone Increasing Digits Medium
742 Closest Leaf in a Binary Tree Medium
746 Min Cost Climbing Stairs Easy
762 Prime Number of Set Bits in Binary Representation Easy
763 Partition Labels Medium
771 Jewels and Stones Easy
775 Global and Local Inversions Medium
776 Split BST Medium
791 Custom Sort String Medium
801 Minimum Swaps To Make Sequences Increasing Medium
819 Most Common Word Easy
842 Split Array into Fibonacci Sequence Medium
851 Loud and Rich