title-img


The Meeting Place Sequel - Amazon Top Interview Questions

You are given a two dimensional integer matrix consisting of: 0 which represents an empty cell. 1 which represents a wall. 2 which represents a person. A person can walk up, down, left, right or stay in one time unit. Find a walkable cell such that it minimizes the time it would take for everyone to meet and return the time. Note: two people can walk through the same empty cell and you can assume there is always some path between any two people. Constraints The number of cells in

View Solution →

Wildfire Sequel- Amazon Top Interview Questions

You are given a two-dimensional integer matrix matrix where 0 represents empty cell 1 represents a person 2 represents fire 3 represents a wall You can assume there's only one person and in each turn fire expands in all four directions although fire can't expand through walls. Return whether the person can move to either the top left corner or the bottom right corner. In each turn, the person moves first, then the fire expands. If the person makes it to either square as the same time a

View Solution →

Zipped String - Amazon Top Interview Questions

Given lowercase alphabet strings a, b, and c return whether there's any way of obtaining c by merging characters in order from a and b. Constraints 0 ≤ n ≤ 1,000 where n is the length of a 0 ≤ m ≤ 1,000 where m is the length of b 0 ≤ k ≤ 1,000 where k is the length of c Example 1 Input a = "abc" b = "def" c = "abdefc" Output True Explanation abdefc is an interleave since abc and def can be interleaved with: abdefc Example 2 Input a = "ab" b = "cd" c = "a

View Solution →

Central Linked List - Amazon Top Interview Questions

Given a singly linked list node, return the value of the middle node. If there's two middle nodes, then return the second one. Bonus: Solve using \mathcal{O}(1)O(1) space. Constraints n ≤ 100,000 where n is the number of nodes in node Example 1 Input node = [0, 1, 2] Output 1

View Solution →

5-Star Review Percentage - Google Top Interview Questions

You are given a two-dimensional list of integers reviews and a positive integer threshold. Each element reviews[i] contains [x, y] meaning product i had x number of 5-star reviews and a total of y reviews. All reviews are for one store. Return the minimum number of additional 5-star reviews we need such that the percentage of 5-star reviews in the store is at least threshold. You can assume that it's possible to reach threshold% of 5-star reviews. Constraints 1 ≤ n ≤ 100,000 where n is

View Solution →