Click a solution to see an animated visualization, complexity, and explanation.
Minimum Window Substring (Characters)
Given a string and a set of required characters (including duplicates), find the smallest substring that contains all required characters. If no such substring exists, return an empty string.
Component Tree Search
Given a nested component tree structure, return all components whose type matches a target value. The traversal must preserve top-to-bottom, left-to-right order.
Deduplicate While Preserving Order
Given a list of items with IDs, remove duplicates by ID while preserving the order of first occurrence.
Dependency Resolution (Topological Sort)
Given a list of modules and dependency pairs where one module depends on another, return an order of modules that satisfies all dependencies. If a cycle exists, return an empty list.
Event Rate Limiting (Rolling Window)
Given a time-ordered list of events, enforce a per-event-type rate limit such that no more than a fixed number of events occur within a rolling time window. Events exceeding the limit are dropped while preserving order.
Reverse Integer
Given a 32-bit signed integer, reverse its digits. Return 0 if the reversed value would overflow the 32-bit signed integer range. Preserve the sign of the input.
Squares of a Sorted Array
Given an integer array sorted in non-decreasing order, return an array of the squares of each number sorted in non-decreasing order. Use O(n) time and O(n) space (excluding output).
Binary Search (Sorted Array)
Given a sorted array of integers and a target value, return the index of the target if it exists, otherwise return -1. Use binary search: repeatedly compare the middle element to the target and narrow the search range.