Interview questions
Find a company or topic. Read the sources, then practice.
Loading the question library…
Find a company or topic. Read the sources, then practice.
Loading the question library…
Showing 2,701–2,725
Companies: Anthropic
Preprocess a list of distinct lowercase words to support queries that ask whether changing exactly one character in a given searchWord can produce any stored…
General practice
Companies: Databricks
Implement a FIFO queue using only stack operations (push, pop/peek, size/isEmpty) by composing two stacks to support push, pop, peek, and empty. Aim for an…
General practice
Implement rand10() using only the uniform rand7() API so that outputs 1..10 are equally likely; the core challenge is converting a size-7 uniform distribution into…
General practice
Design a Router that stores up to memoryLimit packets in FIFO order, rejects duplicates (same source, destination, timestamp), evicts the oldest packet when full, and…
General practice
Implement a LIFO stack using only standard queue operations (push to back, pop/peek from front, size, isEmpty), supporting push, pop, top, and empty; the key…
General practice
Design a prefix tree that supports insert, countWordsEqualTo, countWordsStartingWith, and erase operations, handling duplicate inserts/removals by maintaining node-level…
General practice
Reorder a lowercase string by repeatedly building increasing then decreasing runs: repeatedly append the smallest unused character, then successive larger unused characters…
General practice
Check whether the array contains an increasing triplet subsequence (indices i<j<k with nums[i]<nums[j]<nums[k]). The challenge is to do it efficiently for n up to 5e5…
General practice
Given n and a list of axis-aligned submatrix queries that add +1 to every element in each rectangular region, compute the final n×n matrix; the…
General practice
Simulate a greedy allocation where at second i you allocate i bits to the stick with more available memory (or the first if tied), and…
General practice
Given a string and a list of words, return all index pairs [i, j] where the substring text[i..j] matches any word from the list (overlapping…
General practice
Design an object that allows calling any (unknown) method name repeatedly in a chain—each call returns the same object so chaining can continue indefinitely—and that…
General practice
Given the root of a binary search tree and a target node p, return p's in-order successor — the node with the smallest key greater…
General practice
Given a node in a binary search tree where each node has left, right, and parent pointers (and you may not have the root), find…
General practice
General practice