Category: Binary tree coding problemYou are given the root of a binary tree. You need to install the minimum number of cameras on the tree nodes such that every node in the tree is...Input: Binary tree Output: Integer
codingHardVerified Question#2
2. [CodeSignal] Warehouse Emergency Deliveries
Category: Array coding problemAmazon has opened a new warehouse recently. There are no products in the warehouse currently. The warehouse is under inspection for n days. The...Input: Array Output: Integer
codingHardVerified Question#3
3. [CodeSignal] Permutation Sorter
Category: Combinatorics coding problemAmazon engineers are testing a new tool, the Permutation Sorter, built to reorder sequences using limited operations. Given a permutation of...Input: Integer(s) Output: Integer
codingHardVerified Question#4
4. [CodeSignal] Maximum Product Rating
Category: Array coding problemThe engineers at Amazon are working on a new rating system for their products. For each product, an array customer_rating is maintained for the...Input: Array Output: Computed result
codingMediumVerified Question#5
5. [CodeSignal] Drone Hub Travel
Category: Array coding problemAmazon is expanding its next-generation drone delivery network, consisting of m hubs arranged in a circular ring (Hub 1 is adjacent to Hub m)....Input: Array Output: Computed result
codingMediumVerified Question#6
6. [CodeSignal] Minimum Security Groups
Category: Array coding problemA financial services company has requested AWS for a private deployment of its cloud network. There are n servers in the network where the security...Input: Array Output: Integer
codingMediumVerified Question#7
7. [CodeSignal] Maximum Secure Deliveries
Category: Array coding problemYou are given an array deliveryLogs of size n, where each element represents the number of parts delivered in the i-th log. You are also given...Input: Array Output: Integer
codingMediumVerified Question#8
8. Maximum Interval Overlap
Category: Interval-based coding problemYou are given a list of closed intervals on the number line, where each interval [start, end] includes both endpoints. Find the maximum number of...Input: List Output: Integer
codingMediumtwo pointers#1
1. [OA] Two Pointers — Optimize Amazon's Recommendation Algorithm
Amazon strives to provide relevant product recommendations based on user browsing history and preferences. Utilizing a two-pointer technique can efficiently pair and rank products for recommendations. Given a sorted array of product ratings and a target value, find two indices such that their ratings add up to the target.
2. [OA] Sliding Window — Manage Amazon Price Tracking Features
In the fast-paced e-commerce environment, Amazon needs an efficient way to track price changes over time for various products. This feature enhances user engagement and informs purchasing decisions. Given an array of product prices, implement a function that returns the maximum price within any k day window.
Input: prices = [100, 200, 150, 300, 250], k = 3 Output: [200, 300, 300] Explanation: The maximum prices for the windows are 200 (days 1-3), 300 (days 2-4), and 300 (days 3-5).
3. [OA] Design a Virtual DOM Differ for Amazon's Frontend
In order to optimize rendering performance in Amazon's web applications, a Virtual DOM is used for efficient updates. This problem involves designing the diffing algorithm which reconciles changes in a virtual representation of the DOM.
Class Signature
class VirtualDOM {
def create_element(self, tag: str, props: dict, children: List[Union[str, 'VirtualDOM']]) -> None:
# Create a virtual DOM element
def diff(self, old_tree: 'VirtualDOM', new_tree: 'VirtualDOM') -> List[str]:
# Compute the difference between two trees
}
Example Method Signatures
create_element(tag: str, props: dict, children: List[Union[str, 'VirtualDOM']]) -> None: Creates a virtual DOM element.
diff(old_tree: 'VirtualDOM', new_tree: 'VirtualDOM') -> List[str]: Returns a list of operations needed to update the DOM based on differences.