Given chronologically sorted requests, each with a timestamp, user ID, and experience, implement a sliding-window rate limiter. A request is allowed onl…
Given a text string and a glossary, insert spaces to generate all possible sentences where every segment matches a glossary entry. In Part 2, both the i…
Trending Tracker: Top-K Retrieval You are building a trending tracker. You receive a stream of operations: apply(“inc”, key, delta) — increase the key’s…
Part 1 – Direct links: Given a target merchant, return every merchant that shares at least one identical attribute value with it. Part 2 – Confidence sc…
Design and implement an IntervalSet , also known as a union of ranges . The IntervalSet should support: Inserting intervals Querying whether a particula…
Word Break II Given a string and a dictionary of words, find all ways to break the string into valid words. Return all possible sentences where each wor…
Implement a calculator that can evaluate mathematical expressions given as strings. The expressions can contain: Non-negative integers (0, 1, 2, …) Fo…
Part 1 – Parse and Validate: Remove slots with missing fields, invalid ISO timestamps, or durations other than exactly 10 minutes. Part 2 – Aggregate: G…
Given n sorted arrays, find the kth element among all elements in these arrays. 这道题的核心是把多个已经排好序的数组合并视为一个整体有序序列,再去找第 k 个元素。最直接的做法是使用最小堆:先把每个数组的首元素放入堆中,每次…
Reliable Packet Delivery System Problem Statement You are designing a reliable packet delivery system for Amazon’s internal messaging service. In this s…
Part 1: Parse each CSV row, trim whitespace, and mark a business VERIFIED only when all six KYC fields are present and non-empty; exclude rows without a…
Given a list of envelopes [width, height] , find the maximum number of envelopes that can be nested inside each other. An envelope can go inside another…
Given voters’ ranked candidate ballots, repeatedly eliminate the candidate with the fewest current votes and transfer those votes to each ballot’s next…
A country is represented as a tree of cities originating from a single root city. Each city may be connected to one or more neighboring cities. A virus…
What is deadlock? How do you avoid it? Discuss class components of customer, orders, and discount related to customer order history and order content. W…
Implement an LRU expiring KV cache. All key-value pairs have the same expiration interval, with the following rules: The cache stores at most n key-valu…
Implement debounce in JavaScript. Write a function debounce that takes a function and a delay, and returns a new function that postpones invoking the or…
Implement a reusable DB connection pool. Design a component that manages a fixed set of database connections and allows clients to acquire and release t…