Medium frontend interview questions
378 questions at medium difficulty. Build the muscle for real frontend interviews with a runnable editor and explained solutions.
378 questions
- MEDIUM
0/1 Knapsack
PREMIUMMaximize the value packed into a weight-limited knapsack when each item can be taken at most once — the classic 0/1 dynamic-programming table.
25 minAlgorithms - MEDIUM
A/B Test Bucketing
Assign users to weighted experiment variants deterministically, with a traffic gate and independent buckets per experiment.
25 minJavaScript - MEDIUM
Abortable Fetch with Timeout
PREMIUMFetch with a timeout that aborts the request via AbortController and honors an external abort signal.
25 minJavaScript - MEDIUM
Accordion II
Build an accordion component with the correct ARIA roles, states, and properties for screen readers.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Analog Clock
Build an analog clock whose hour, minute, and second hands move smoothly to reflect the current time.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Analytics Event SDK
PREMIUMBuild an analytics client that queues tracked events, flushes them in batches, and retries failed sends with backoff.
25 minJavaScript - MEDIUM
Arithmetic Expression Evaluator
Tokenize and evaluate a math expression string with operator precedence, parentheses, and unary minus.
35 minJavaScriptGoogle · Amazon · Microsoft - MEDIUM
Array Product Excluding Current
Return an array where each entry is the product of every element except the one at that index, without division and in O(n).
25 minAlgorithmsAmazon · Meta · Microsoft - MEDIUM
Array.fromAsync
Implement Array.fromAsync: build a promise of an array from a sync or async iterable, awaiting each value in order.
30 minJavaScript - MEDIUM
Array.prototype.concat
Implement Array.prototype.myConcat — merge arrays and values into a new array, spreading nested arrays one level deep.
25 minJavaScript - MEDIUM
Array.prototype.find
Implement Array.prototype.find and findLast — return the first or last element matching a predicate, or undefined.
25 minJavaScript - MEDIUM
Array.prototype.flatMap
Implement Array.prototype.flatMap — map each element, then flatten the mapped results by one level.
25 minJavaScript - MEDIUM
Array.prototype.map
PREMIUMImplement Array.prototype.myMap — return a new array with the callback applied to each element, skipping holes.
25 minJavaScript - MEDIUM
Array.prototype.myReduce
PREMIUMImplement Array.prototype.myReduce — the reduce method from scratch, including the empty-array + initial-value edge cases.
20 minJavaScriptGoogle · Meta · Amazon - MEDIUM
Array.prototype.reduce
PREMIUMImplement Array.prototype.myReduce — fold an array down to one value, handling sparse arrays and missing initial values.
25 minJavaScript - MEDIUM
Array.prototype.reduceRight
Implement Array.prototype.reduceRight — fold an array right-to-left, throwing on an empty array with no initial value.
25 minJavaScript - MEDIUM
Array.prototype.splice
Implement Array.prototype.splice — remove and insert elements in place, returning the removed ones, with clamped indices.
25 minJavaScript - MEDIUM
Async Autocomplete
Build an autocomplete that debounces typing, fetches matching results from an API, and handles loading and stale responses.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Async Debounce (Latest Wins)
Implement an async debounce that resolves only the newest call and discards the results of superseded ones.
25 minJavaScript - MEDIUM
Async Memoize with TTL
Implement an async memoize that caches results by key for a TTL and coalesces concurrent calls for the same key.
25 minJavaScript - MEDIUM
Async Mutex
PREMIUMImplement an async mutex whose acquire returns a release function, serializing access so only one holder runs at a time.
25 minJavaScript - MEDIUM
Async Semaphore
PREMIUMImplement an async semaphore that admits up to N concurrent holders and queues the rest until a permit frees.
25 minJavaScript - MEDIUM
Async Task Queue
PREMIUMImplement a task queue that runs async jobs under a concurrency limit and resolves an idle promise when drained.
25 minJavaScript - MEDIUM
Autoplay Carousel
Build an image carousel that auto-advances on a timer, pauses on hover, and has manual controls.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Base Converter
PREMIUMConvert a number's string representation between any two bases from 2 to 36 — parse the digits in the source base, then re-emit them in the target base.
25 minJavaScript - MEDIUM
Base64 atob / btoa
Implement base64 encoding and decoding from scratch — pack bytes into 6-bit groups, map to the alphabet, and handle padding.
35 minJavaScript - MEDIUM
Batch Event Flusher
Buffer events and flush them in batches when a size threshold or a max-wait timer is reached.
25 minJavaScript - MEDIUM
before / after
Implement before and after — cap how many times a function runs, or delay invoking it until the Nth call.
25 minJavaScript - MEDIUM
BigInt String Arithmetic
PREMIUMAdd and multiply arbitrarily large non-negative integers given as decimal strings, using digit-by-digit schoolbook arithmetic with carries.
25 minJavaScript - MEDIUM
Binary Search
Implement binary search on a sorted array, returning the index of the target or -1 when absent.
25 minAlgorithms - MEDIUM
Binary Search Tree Kth Smallest Element
Implement a function that returns the kth smallest value in a binary search tree.
25 minAlgorithms - MEDIUM
Binary Search Tree Lowest Common Ancestor
Implement a function that finds the lowest common ancestor of two nodes in a binary search tree.
25 minAlgorithms - MEDIUM
Binary Tree
Build a binary tree data structure with the essential insert, traverse, and search operations.
25 minAlgorithms - MEDIUM
Binary Tree Level Order Traversal
Implement a function that returns the values of a binary tree grouped by level from top to bottom.
25 minAlgorithms - MEDIUM
Binary Tree Rebuilding from Preorder and Inorder Traversals
Implement a function that reconstructs a binary tree given its preorder and inorder traversal sequences.
25 minAlgorithms - MEDIUM
Binary Tree Subtree
Implement a function that determines whether one binary tree appears as a subtree of another.
25 minAlgorithms - MEDIUM
Birth Year Histogram
Build a widget that fetches birth year data from an API and renders it as a histogram of bucketed counts.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Bit Counting
Implement a function that returns an array of set-bit counts for every integer from 0 up to n.
25 minAlgorithms - MEDIUM
Bloom Filter
PREMIUMBuild a Bloom filter — a compact probabilistic set that answers membership with no false negatives but possible false positives, using a bit array and several hash functions.
25 minAlgorithms - MEDIUM
Breadth-First Search
Implement breadth-first traversal of a directed graph, visiting nodes level by level from a start vertex.
25 minAlgorithms - MEDIUM
Caesar Cipher / ROT13
Shift each letter by a fixed amount with wraparound, preserving case and passing non-letters through — with ROT13 as the self-inverse case.
25 minJavaScript - MEDIUM
Camel Case Keys
Implement a function that returns a new object with every key converted to camelCase, recursing into nested objects.
25 minJavaScript - MEDIUM
Cancellable Promise
PREMIUMWrap a promise so it can be cancelled — the wrapper rejects on cancel and ignores the underlying settlement.
25 minJavaScript - MEDIUM
Case Converters
Convert any string between camelCase, snake_case, kebab-case, and PascalCase by tokenizing it into words first.
35 minJavaScript - MEDIUM
Circuit Breaker
PREMIUMImplement a circuit breaker that trips open after repeated failures, rejects fast while open, then probes half-open.
25 minJavaScript - MEDIUM
Class Variance Authority
Implement a simplified cva that builds class names from base styles, variant tables, and default values.
25 minJavaScript - MEDIUM
classNames
Implement a utility that conditionally joins class name arguments into a single space-separated string.
25 minJavaScript - MEDIUM
Combinations for Target Sum
Implement a function that returns every unique combination of reusable candidates that sums to a target.
25 minAlgorithms - MEDIUM
Combobox
PREMIUMBuild an editable combobox that filters options as you type and supports full keyboard selection.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Command Palette
PREMIUMBuild a keyboard-driven command palette with fuzzy search and arrow-key navigation.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Compact II
Implement a function that returns a deep copy of an object with all falsy values stripped from nested structures.
25 minJavaScript - MEDIUM
Conforms To
Implement a function that checks whether an object satisfies a source schema of predicate validators.
25 minJavaScript - MEDIUM
Connect Four
Build a two-player Connect Four game where discs fall to the lowest empty slot and four-in-a-row wins.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Console Log History
Implement a wrapper that intercepts console.log calls and records their arguments for later inspection.
25 minJavaScript - MEDIUM
Corresponding Node Across Pages
Implement a function that locates the node in a mirrored DOM tree occupying the same path as a given node.
25 minJavaScript - MEDIUM
Count By
Implement a function that tallies how many array elements map to each key produced by an iteratee.
25 minJavaScript - MEDIUM
Count Islands in a Grid
Implement a function that counts the number of distinct islands of connected cells in a 2D binary grid.
25 minAlgorithms - MEDIUM
Counting / Radix Sort
Sort integers without comparisons — counting sort tallies occurrences into buckets, and radix sort applies it digit by digit from the least significant.
25 minAlgorithms - MEDIUM
Course Dependency
Implement a function that decides whether a set of courses can be finished given their prerequisite pairs.
25 minAlgorithms - MEDIUM
createGlobalState
Build a useState shared by every component that calls it, by subscribing React to a store that lives outside it.
25 minJavaScript - MEDIUM
createStore + useSelector
Build a store whose subscribers each re-render only when the slice they selected changes.
25 minJavaScript - MEDIUM
CSS Selector Matches
Implement Element.matches: test whether an element satisfies a compound CSS selector (tag, id, class, attribute).
25 minJavaScript - MEDIUM
Currency Converter
Build a currency converter with two linked amount fields that recompute from an exchange rate.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Curry
Implement a function that transforms a multi-argument function into a chain of single-argument calls.
25 minJavaScript - MEDIUM
Curry II
Implement a flexible curry where each call can supply any number of arguments until the original arity is reached.
25 minJavaScript - MEDIUM
Curry IV
PREMIUMExtend curry with placeholder support, so arguments can be supplied in any position across calls.
40 minJavaScript - MEDIUM
Data Table
Build a users data table that paginates rows with page-size and page-navigation controls.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Data Table II
Build a users data table that lets you sort by any column in ascending or descending order.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Date Picker
PREMIUMBuild a calendar date picker that renders a month grid, navigates between months, and selects a day.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Debounce II
PREMIUMExtend debounce with cancel and flush methods to abort or immediately invoke pending calls.
25 minJavaScript - MEDIUM
Debounce III
PREMIUMExtend debounce with a maxWait option that forces a call after a maximum delay even under constant activity.
25 minJavaScript - MEDIUM
Decode Message
Implement a function that counts how many ways a digit string can be decoded into letters using a 1 to 26 mapping.
25 minAlgorithms - MEDIUM
Deep Clone
PREMIUMImplement a function that recursively clones a JSON-serializable value without sharing references.
25 minJavaScript - MEDIUM
Deep Freeze
Recursively freeze an object and every nested object and array, making the whole structure deeply immutable.
25 minJavaScript - MEDIUM
Deep Map
PREMIUMImplement a function that walks an arbitrarily nested structure and applies a transform to every leaf value.
25 minJavaScript - MEDIUM
Deep Merge
PREMIUMImplement a function that recursively merges two objects, combining nested properties rather than overwriting them.
25 minJavaScript - MEDIUM
Deep Omit
PREMIUMImplement a function that returns a copy of a value with the given keys stripped from every nested object.
25 minJavaScript - MEDIUM
Delete Nth Node from End of Linked List
Implement a function that removes the nth-from-end node from a singly linked list in one pass.
25 minAlgorithms - MEDIUM
Dependency Injection Container
Build a DI container that resolves a service dependency graph, caches singletons, and detects circular dependencies.
25 minJavaScriptGoogle · Microsoft · Uber - MEDIUM
Depth-First Search
Implement depth-first traversal of a directed graph, exploring each branch fully before backtracking.
25 minAlgorithms - MEDIUM
Deque (Double-Ended Queue)
Build a double-ended queue with constant-time push and pop at both the front and the back, backed by a doubly linked list.
25 minAlgorithms - MEDIUM
Dice Roller
Build a dice roller that lets you pick a count of six-sided dice, roll them, and display the resulting faces.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Digital Clock
Build a 7-segment style digital clock that updates to display the current time.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Disjoint Intervals
Implement a function that returns the minimum number of intervals to remove so the remaining ones do not overlap.
25 minAlgorithms - MEDIUM
Distinct Paths in Grid
Implement a function that counts the number of unique paths a robot can take from the top-left to bottom-right of an m by n grid.
25 minAlgorithms - MEDIUM
DOM Method Chaining
PREMIUMBuild a jQuery-style wrapper whose methods return this so calls like addClass().text() chain.
25 minJavaScript - MEDIUM
Dropdown Menu
Build an accessible dropdown menu that opens on click, closes on outside-click and Escape, and supports arrow-key navigation.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Edit Distance
PREMIUMCompute the minimum number of insertions, deletions, and replacements to turn one string into another — the Levenshtein distance via a 2D dynamic-programming table.
25 minAlgorithms - MEDIUM
Emoji Picker
Build an emoji picker with category tabs and a search filter that inserts the chosen emoji.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
End of Array Reachable
Implement a function that decides whether you can reach the last index of an array using each element as a max jump.
25 minAlgorithms - MEDIUM
ES5 Class Inheritance
Wire up classical inheritance the pre-class way — link prototypes with Object.create, restore the constructor, and call the superclass constructor.
30 minJavaScript - MEDIUM
ETag Revalidation Cache
Cache responses by URL and revalidate with an ETag, reusing cached data on a 304 Not Modified.
25 minJavaScript - MEDIUM
Event Emitter
Implement an EventEmitter class supporting on, off, and emit to register and trigger listeners.
25 minJavaScript - MEDIUM
Event Emitter II
PREMIUMImplement an event emitter where subscribe returns a handle whose release method removes that listener.
25 minJavaScript - MEDIUM
Excel Column ↔ Number
Convert between Excel column titles and numbers in both directions — A is 1, Z is 26, AA is 27 — the classic bijective base-26 system with no zero digit.
25 minJavaScript - MEDIUM
Fast Power
Raise a base to an integer exponent in logarithmic time using exponentiation by squaring, handling negative exponents.
25 minAlgorithms - MEDIUM
Feature Flag Client
PREMIUMEvaluate feature flags with targeting rules and a deterministic percentage rollout that stays sticky per user.
25 minJavaScript - MEDIUM
File Explorer
Build a file explorer that renders a nested folder hierarchy and lets you expand and collapse directories.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
File Explorer II
Build a file explorer that exposes the correct ARIA tree roles, states, and properties for assistive tech.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
File Explorer III
Build a file explorer that renders the tree as a flat DOM list while preserving nested visual structure.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Find Element in Rotated Array
Implement a function that locates a target integer in a sorted array that has been rotated at an unknown pivot.
25 minAlgorithms - MEDIUM
Find the Longest Palindromic Substring
Implement a function that returns the longest palindromic substring contained within a given string.
25 minAlgorithms - MEDIUM
Find Word in Grid
Implement a function that checks whether a target word can be traced through adjacent cells in a 2D character grid.
25 minAlgorithms - MEDIUM
Finite State Machine
PREMIUMImplement a state machine from a config of states and transitions, with send, guards, and entry actions.
25 minJavaScript - MEDIUM
Flatten
Implement a function that recursively flattens a nested array into a single-level array.
25 minJavaScript - MEDIUM
flow
Implement flow — compose functions left to right so each output feeds the next.
25 minJavaScript - MEDIUM
Form Serialize
PREMIUMSerialize a form's fields into a nested object, handling checkboxes, multi-selects, and bracket names.
25 minJavaScript - MEDIUM
Form Validation Engine
Build a schema-driven form validator with composable per-field rules, cross-field checks, and async validators that report all errors.
30 minJavaScriptStripe · Atlassian · Airbnb - MEDIUM
Function.prototype.apply
Implement Function.prototype.myApply — invoke the function with a given `this` and an array of arguments.
25 minJavaScript - MEDIUM
Function.prototype.bind
PREMIUMImplement Function.prototype.myBind — return a new function with a fixed `this` and optional preset arguments.
25 minJavaScript - MEDIUM
Function.prototype.call
Implement Function.prototype.myCall — invoke the function with a given `this` and a list of arguments.
25 minJavaScript - MEDIUM
G/PN-Counter CRDT
Build increment and decrement counters that merge by per-node maxima into a conflict-free convergent total.
25 minJavaScript - MEDIUM
GCD / LCM
Compute the greatest common divisor with Euclid's algorithm and the least common multiple, for two numbers or a whole list.
25 minAlgorithms - MEDIUM
Generate Parentheses
Generate every well-formed combination of n pairs of parentheses by backtracking — add an open bracket while any remain, and a close bracket only while it stays balanced.
25 minAlgorithms - MEDIUM
Get
PREMIUMImplement a function that safely reads a nested object path and returns a default when any segment is missing.
25 minJavaScript - MEDIUM
get / set
Implement get and set — read and write a nested value by a path like 'a.b[0].c', creating missing containers on set.
25 minJavaScript - MEDIUM
getElementsByClassName
Implement a function that returns all DOM elements containing every one of the specified class names.
25 minJavaScript - MEDIUM
getElementsByStyle
Implement a function that returns all DOM elements whose computed style matches a given property and value.
25 minJavaScript - MEDIUM
getElementsByTagName
Implement a function that walks a DOM tree and returns every descendant element matching a given tag name.
25 minJavaScript - MEDIUM
Graph Clone
Implement a function that produces a deep copy of a connected, undirected graph given a reference node.
25 minAlgorithms - MEDIUM
Graph Count Connected Components
Implement a function that counts the number of connected components in an undirected graph given its edges.
25 minAlgorithms - MEDIUM
Grid Lights
Build a grid of cells that light up on click and then deactivate one by one in the reverse order they were activated.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Group By
Implement a function that buckets array elements into an object keyed by the value an iteratee returns for each.
25 minJavaScript - MEDIUM
Hash Router
PREMIUMBuild a client-side router over location.hash with route params and a change subscription.
25 minJavaScript - MEDIUM
Heatmap Calendar
Build a contribution-style heatmap calendar that colors each day cell by its activity value.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
History Router
PREMIUMBuild a client-side router over the History API (pushState/popstate) with path params.
25 minJavaScript - MEDIUM
HTML Sanitizer
Implement a simplified HTML sanitizer that strips out unsafe tags and attributes from a given DOM tree.
25 minJavaScript - MEDIUM
HTML Serializer
Implement a function that serializes a tree-shaped object into a pretty-printed HTML string with indentation.
25 minJavaScript - MEDIUM
HTTP Client Interceptors
PREMIUMBuild an axios-style client whose request and response interceptors transform each call as it passes through the chain.
25 minJavaScript - MEDIUM
i18n Engine
PREMIUMBuild a translation engine with nested key lookup, variable interpolation, pluralization, and locale fallback.
25 minJavaScript - MEDIUM
ICU Message Formatter
Parse and format ICU MessageFormat strings with plural, select, and nested argument substitution.
25 minJavaScript - MEDIUM
Idempotency Key Queue
Dedupe by idempotency key: run a task at most once per key, cache the result with a TTL, and retry on failure.
35 minJavaScript - MEDIUM
Identical DOM Trees
Implement a function that recursively compares two DOM trees and returns whether they are structurally equal.
25 minJavaScript - MEDIUM
Image Carousel
Build an image carousel that lets you page through a sequence of images with previous and next controls.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Image Carousel II
Build an image carousel with smooth slide transitions between images.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Immutable Array Methods
Implement the ES2023 change-by-copy trio — toSorted, toReversed, and with — that copy an array instead of mutating it.
30 minJavaScript - MEDIUM
Infinite Scroll List
Build a list that loads more items as the user scrolls near the bottom using an observer.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
instanceof
PREMIUMImplement an instanceof check — walk the prototype chain to see whether a constructor's prototype appears in it.
40 minJavaScript - MEDIUM
Integer Square Root
Compute the integer square root — the floor of the real square root — using Newton's method, without Math.sqrt.
25 minAlgorithms - MEDIUM
Intersection By
Implement a function that intersects arrays by comparing values produced by an iteratee, keeping uniqueness.
25 minJavaScript - MEDIUM
Intersection With
Implement a function that intersects arrays using a user-supplied comparator to decide equality between elements.
25 minJavaScript - MEDIUM
IntersectionObserver Polyfill
Implement a scroll/resize-driven fallback that reports when observed elements enter the viewport.
25 minJavaScript - MEDIUM
invert
Implement invert and invertBy — swap an object's keys and values, grouping collisions with invertBy.
25 minJavaScript - MEDIUM
IPv4 / IPv6 Validate
Validate IPv4 dotted-quad and IPv6 addresses, handling octet ranges, leading zeros, and :: zero-group compression.
25 minJavaScript - MEDIUM
Is Empty
Implement a function that decides whether a value is empty across arrays, strings, objects, Maps, Sets, and primitives.
20 minJavaScript - MEDIUM
Is the Graph a Tree
Implement a function that determines whether a given undirected graph forms a valid tree.
25 minAlgorithms - MEDIUM
Iterator Helpers
Build lazy, chainable iterator helpers — map, filter, take, drop, and flatMap — that pull one value at a time.
35 minJavaScript - MEDIUM
Job Board
Build a job board that fetches and renders recent Hacker News job postings with paginated loading.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
jQuery Class Manipulation
Implement chainable addClass, removeClass, toggleClass, and hasClass helpers on a DOM element wrapper.
25 minJavaScript - MEDIUM
JSON Path Query
PREMIUMResolve a dotted path with array indices and a wildcard against a nested object, returning matches.
25 minJavaScript - MEDIUM
JSON.stringify
PREMIUMImplement a function that converts a JavaScript value into its JSON string representation.
25 minJavaScript - MEDIUM
JSX Runtime
PREMIUMImplement the jsx() factory (type, props, children) that a JSX transform compiles to.
25 minJavaScript - MEDIUM
Kanban Board
PREMIUMBuild a three-column board where cards drag between columns and each column's count updates.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Lazy Load Images
PREMIUMSwap each image's data-src into src as it nears the viewport, using an IntersectionObserver.
25 minJavaScript - MEDIUM
Limit
Implement a function that wraps a callback so it runs at most N times and returns the last result thereafter.
25 minJavaScript - MEDIUM
Linked List
Build a singly linked list data structure with the standard insert, remove, and traversal operations.
25 minAlgorithms - MEDIUM
Linked List Detect Cycle
PREMIUMImplement a function that detects whether a singly linked list contains a cycle.
25 minAlgorithms - MEDIUM
localStorage With Expiry
Implement a localStorage wrapper that stores values with a TTL and returns null once an entry has expired.
25 minJavaScript - MEDIUM
Long-Polling Client
Build a long-polling loop that re-issues a held request as each returns, advances a cursor, backs off on error, and stops cleanly.
35 minJavaScript - MEDIUM
Longest Common Subsequence
Implement a function that returns the length of the longest subsequence common to two input strings.
25 minAlgorithms - MEDIUM
Longest Consecutive Number Sequence
Implement a function that returns the length of the longest run of consecutive integers found in an unsorted array.
25 minAlgorithms - MEDIUM
Longest Increasing Subsequence
Implement a function that returns the length of the longest strictly increasing subsequence in an array.
25 minAlgorithms - MEDIUM
Longest Non-repeating Substring
Implement a function that returns the length of the longest substring containing no duplicate characters.
25 minAlgorithms - MEDIUM
Longest Repeating Substring After Replacements
Implement a function that finds the longest substring made of one repeated character allowing up to k swaps.
25 minAlgorithmsGoogle · Amazon · Meta - MEDIUM
LRU Cache
PREMIUMImplement a fixed-capacity least-recently-used cache with O(1) get and put via a map plus a linked list.
25 minJavaScript - MEDIUM
LWW Register / Map CRDT
PREMIUMBuild a last-write-wins map whose entries merge by timestamp with a deterministic node-id tiebreak.
25 minJavaScript - MEDIUM
Make Counter II
Implement a factory that returns a counter object with methods to read, increment, decrement, and reset its value.
25 minJavaScript - MEDIUM
Map Async
Implement a function that applies an async mapper to every item in an array and resolves with the results.
25 minJavaScript - MEDIUM
Map With History
Implement a class that records timestamped writes and returns the most recent value at or before a queried timestamp.
25 minAlgorithms - MEDIUM
mapKeys / mapValues
Implement mapKeys and mapValues — transform an object's keys or values while preserving its structure.
25 minJavaScript - MEDIUM
Markdown Parser
PREMIUMParse a subset of Markdown (headings, bold, italics, links, code) into an HTML string.
25 minJavaScript - MEDIUM
Matrix Rotation
Rotate an n×n matrix 90 degrees clockwise and return the result as a new array.
25 minAlgorithmsAmazon · Microsoft · Apple - MEDIUM
Matrix Spiral Traversal
Implement a function that walks a 2D matrix in clockwise spiral order and returns the visited values.
25 minAlgorithms - MEDIUM
Matrix Zeroing
Implement a function that zeroes out every row and column in a matrix that originally contained a zero, ideally in place.
25 minAlgorithms - MEDIUM
Maximal Square
Find the area of the largest all-ones square in a binary matrix, where each cell's square size is one more than the smallest of its top, left, and top-left neighbors.
25 minAlgorithms - MEDIUM
Maximum Product in Contiguous Array
Implement a function that finds the contiguous subarray with the largest product, handling negatives and zeros.
25 minAlgorithms - MEDIUM
Maximum Sum in Contiguous Array
Implement a function that finds the contiguous subarray with the largest sum.
25 minAlgorithms - MEDIUM
Maximum Water Trapped Between Walls
Implement a function that finds the maximum amount of water that can be trapped between two walls.
25 minAlgorithms - MEDIUM
Memoize
Implement a function that caches results of a single-argument function so repeat calls return instantly.
25 minJavaScript - MEDIUM
Memoize II
PREMIUMImplement a memoize helper that caches results for functions called with any number and type of arguments.
25 minJavaScript - MEDIUM
Memoize III
PREMIUMExtend memoize with a custom key resolver and cache controls (.clear() and .delete(key)).
25 minJavaScript - MEDIUM
Memory Game
Build a memory card-matching game where players flip cards to find matching pairs.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Merge New Interval
Implement a function that inserts a new interval into a sorted list and merges any resulting overlaps.
25 minAlgorithms - MEDIUM
Merge Overlapping Intervals
Implement a function that merges all overlapping intervals in a list and returns the consolidated set in sorted order.
25 minAlgorithms - MEDIUM
Merge Sort
Implement merge sort recursively by splitting the array and merging the sorted halves back together.
25 minAlgorithms - MEDIUM
Microtask Batch Scheduler
Coalesce all schedule calls made in one synchronous frame into a single flush on the next microtask.
25 minJavaScript - MEDIUM
Mini Jotai Atoms
Build atom-based state with primitive and derived atoms that recompute and notify subscribers on change.
25 minJavaScript - MEDIUM
Mini Object-relational Mapper
Build a simplified in-memory ORM with model delegates that expose basic CRUD operations.
25 minJavaScript - MEDIUM
Mini Object-relational Mapper II
Extend a simplified in-memory ORM with richer filtering predicates and multi-field sorting.
25 minJavaScript - MEDIUM
Mini Redux
PREMIUMBuild a Redux core with createStore, combineReducers, and applyMiddleware over a subscribe/dispatch loop.
25 minJavaScript - MEDIUM
Mini Template Engine
PREMIUMImplement a string template engine with {{ variable }} interpolation and nested-path lookup.
25 minJavaScript - MEDIUM
Minimum Coins for Change
Implement a function that returns the fewest coins needed to make a target amount, or -1 when no combination works.
25 minAlgorithms - MEDIUM
Minimum Meeting Rooms Needed
Implement a function that returns the fewest meeting rooms required to host a list of time intervals without conflicts.
25 minAlgorithms - MEDIUM
Minimum Path Sum
Find the cheapest path from the top-left to the bottom-right of a grid, moving only right or down, by summing each cell with the smaller of the two ways to reach it.
25 minAlgorithms - MEDIUM
Modal Dialog II
Build a modal dialog with the correct ARIA roles, states, and properties for assistive technology.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Modal Dialog III
Build a modal dialog that closes via the close button, backdrop click, and the Escape key.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Most Common Elements
Implement a function that returns the k most frequent integers in an array, breaking ties consistently.
25 minAlgorithms - MEDIUM
Multi-Select
Build a multi-select where chosen options become removable chips and the rest stay in the list.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Multi-Step Form
Build a wizard form with next/back navigation, per-step validation, and a progress indicator.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Mutation Observer Mini
Build a mini MutationObserver that diffs a subtree on demand and reports added and removed nodes.
25 minJavaScript - MEDIUM
negate / overEvery
Implement negate, overEvery, and overSome — build new predicates by combining existing ones.
25 minJavaScript - MEDIUM
Neighborhood Theft
Implement a function that computes the maximum money you can rob from a row of houses without picking two adjacent ones.
25 minAlgorithms - MEDIUM
Neighborhood Theft (Circular)
Implement a function that maximizes loot from houses arranged in a circle without robbing two adjacent ones.
25 minAlgorithms - MEDIUM
Nested Comments
PREMIUMBuild a threaded comments tree where each comment can be replied to and collapsed recursively.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Node Registry
Implement a registry that associates values with DOM nodes without leaking memory once nodes are gone.
25 minJavaScript - MEDIUM
Normalized Entity Cache
Store entities flat by id, normalizing nested relations and merging updates immutably.
25 minJavaScript - MEDIUM
Notification Center
Build a notification center with an unread badge, mark-as-read, and dismiss.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Object Path set / unset
Implement lodash-style set and unset: write or delete a value at a deep object path, creating containers as needed.
35 minJavaScript - MEDIUM
Object.assign
Implement Object.assign — copy own enumerable string and symbol properties from sources onto a target, skipping nullish.
25 minJavaScript - MEDIUM
Object.create
PREMIUMImplement Object.create — make a new object with a given prototype and optional property descriptors.
40 minJavaScript - MEDIUM
Observable Store
Build a tiny state store with getState, setState, and subscribe that notifies listeners on change.
25 minJavaScript - MEDIUM
Ocean Flow
Implement a function that returns every grid cell from which water can flow to both the Pacific and Atlantic oceans.
25 minAlgorithms - MEDIUM
Online/Offline Flush Manager
Queue writes while offline and flush them in FIFO order when the network returns, retrying failures without dropping or reordering.
35 minJavaScript - MEDIUM
OR-Set CRDT
Build an observed-remove set where a concurrent add and remove converge with the add winning.
25 minJavaScript - MEDIUM
orderBy
Implement orderBy — stably sort objects by multiple keys, each ascending or descending.
25 minJavaScript - MEDIUM
OTP Input
Build a one-time-code input of separate boxes with auto-advance, backspace, and paste handling.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Palindrome Partitioning
Split a string every possible way so that each piece is a palindrome — backtrack over cut positions, extending a piece only while it reads the same both ways.
25 minAlgorithms - MEDIUM
Palindromic Substrings
Implement a function that counts every palindromic substring within a string, including overlapping occurrences.
25 minAlgorithms - MEDIUM
partial
Implement partial and partialRight — pre-fill some of a function's arguments, with placeholder support.
25 minJavaScript - MEDIUM
partition
Implement partition — split an array into elements that pass a predicate and those that fail, in one pass.
25 minJavaScript - MEDIUM
Partition Equal Subset Sum
Decide whether an array can split into two subsets with equal sums — a subset-sum dynamic-programming problem over half the total.
25 minAlgorithms - MEDIUM
Permutations & Subsets
PREMIUMGenerate every permutation and every subset of an array with the same backtracking template — choose, recurse, and undo.
25 minAlgorithms - MEDIUM
Phone Letter Combinations
List every letter string a phone number could spell, mapping each digit to its keypad letters and backtracking through the choices.
25 minAlgorithms - MEDIUM
pick / omit
Implement pick, omit, pickBy, and omitBy — build a subset of an object by a key list or by a predicate.
25 minJavaScript - MEDIUM
Pixel Art
Build a pixel art editor where you pick a color from a palette and paint individual cells on a grid canvas.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Plugin Hook Registry
Build a WordPress/Tapable-style hook system where plugins tap named actions and filters that run in priority order.
25 minJavaScript - MEDIUM
Poll Until
Implement pollUntil — call an async function on an interval until a predicate passes or a timeout elapses.
25 minJavaScript - MEDIUM
Prime Check / Sieve
Test whether a number is prime and generate all primes up to n with the Sieve of Eratosthenes.
25 minAlgorithms - MEDIUM
Priority Request Scheduler
PREMIUMSchedule async requests under a concurrency limit, always running the highest-priority waiter next with a stable FIFO tiebreak.
35 minJavaScript - MEDIUM
Progress Bars II
Build a list of progress bars that fill in sequence, each one starting only after the previous bar finishes.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Progress Bars III
Build a list of progress bars that fill concurrently with at most three running at the same time.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Promise Merge
Implement a function that combines the results of two promises into a single value using a merger function.
25 minJavaScript - MEDIUM
Promise Pool
Implement a promise pool that runs task factories with a concurrency cap and resolves to their results in order.
25 minJavaScript - MEDIUM
Promise Timeout
Implement a function that races a promise against a timer and rejects if the promise doesn't settle in time.
25 minJavaScript - MEDIUM
Promise.all
Implement Promise.all so it resolves with an array of results or rejects on the first rejection.
25 minJavaScript - MEDIUM
Promise.allSettled
PREMIUMImplement Promise.allSettled from scratch, resolving to an array of fulfilled or rejected outcomes for each input.
25 minJavaScript - MEDIUM
Promise.any
PREMIUMImplement Promise.any so it resolves with the first fulfilled value or rejects with an AggregateError.
25 minJavaScript - MEDIUM
Promise.resolve
Implement Promise.resolve — wrap a value in a fulfilled promise, returning thenables unchanged and adopting their state.
25 minJavaScript - MEDIUM
Promise.withResolvers
Implement Promise.withResolvers — return a new promise alongside its external resolve and reject functions.
25 minJavaScript - MEDIUM
Promisify
PREMIUMImplement a function that wraps a Node-style error-first callback function so it returns a promise.
25 minJavaScript - MEDIUM
Promisify II
PREMIUMExtend promisify so the wrapped function can override the resolved value via a custom override hook.
25 minJavaScript - MEDIUM
PubSub with Wildcards
Implement an event bus whose subscriptions support wildcard segments matching any single topic level.
25 minJavaScript - MEDIUM
Pull / PullAll
Implement lodash pull and pullAll — remove every occurrence of the given values from an array in place, mutating the original.
30 minJavaScript - MEDIUM
Query Selector All
Implement querySelectorAll for descendant-combinator selectors, returning matches in document order.
25 minJavaScript - MEDIUM
Queue via Two Stacks
Build a FIFO queue out of two LIFO stacks — pour one stack into the other so the reversed order dequeues oldest-first in amortized constant time.
25 minAlgorithms - MEDIUM
Quick Sort
Implement quick sort recursively, partitioning around a pivot and sorting each side independently.
25 minAlgorithms - MEDIUM
Quickselect
PREMIUMFind the k-th smallest element of an unsorted array in average linear time by partitioning, without fully sorting it.
25 minAlgorithms - MEDIUM
Range Slider
Build a dual-handle range slider that picks a min and max value by dragging each handle.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Rate Limiter
Implement a sliding-window rate limiter that decides which task timestamps fit within the allowed quota.
25 minJavaScript - MEDIUM
Reading Order
Implement a function that sorts positioned canvas elements into natural left-to-right, top-to-bottom reading order.
25 minAlgorithms - MEDIUM
Reading Order II
Implement a function that groups misaligned 2D canvas elements into rows, then sorts them into a natural reading order.
25 minAlgorithms - MEDIUM
Rearrange Linked List
Implement a function that reorders a singly linked list by interleaving nodes from the front and the reversed back half.
25 minAlgorithms - MEDIUM
Reconnecting WebSocket
PREMIUMWrap a WebSocket so it auto-reconnects with exponential backoff, queues sends while down, and re-emits its events.
35 minJavaScript - MEDIUM
Redux Middleware (Thunk + Logger)
PREMIUMImplement the curried Redux middleware chain with working thunk and logger middleware.
25 minJavaScript - MEDIUM
Reselect Selectors
PREMIUMBuild memoized selectors that recompute only when their input selections change by reference.
25 minJavaScript - MEDIUM
Resilient Fetch Wrapper
Wrap an async call with retries, backoff, and a per-attempt timeout so transient failures recover.
25 minJavaScript - MEDIUM
Resizable Split Pane
Build two panes split by a draggable divider that resizes them within min and max bounds.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Resize Observer Mini
Build a polling-based ResizeObserver that reports elements whose content-box size has changed.
25 minJavaScript - MEDIUM
Resumable Interval
Implement an interval helper that exposes start, pause, and resume controls while preserving elapsed progress.
25 minJavaScript - MEDIUM
Retry with Backoff
Implement retry — re-run a failing async function with a delay that grows exponentially between attempts.
25 minJavaScript - MEDIUM
Roman Numerals ↔ Integer
Convert between Roman numerals and integers in both directions, handling subtractive notation like IV, IX, and XL.
25 minJavaScript - MEDIUM
Round to Precision
Round, floor, and ceil a number to N decimal places without the classic floating-point drift — 1.005 must round to 1.01, not 1.00.
25 minJavaScript - MEDIUM
Run-Length Encoding
Implement run-length encoding: compress runs of repeated characters into count+char pairs, and decode them back.
25 minJavaScript - MEDIUM
Schema Validator
Implement a small schema library that validates primitives and flat object shapes with composable rules.
25 minJavaScript - MEDIUM
Schema Validator II
Build a tiny schema validation library that supports chainable min and max rules on primitive types.
25 minJavaScript - MEDIUM
Search a 2D Matrix
Search a matrix whose rows and columns are both sorted by walking a staircase from the top-right corner, eliminating a whole row or column at each step.
25 minAlgorithms - MEDIUM
Segment Words
Implement a function that decides whether a string can be broken into a sequence of words from a given dictionary.
25 minAlgorithmsAmazon · Google · Meta - MEDIUM
Semver Compare
PREMIUMParse and compare two semantic version strings — major, minor, patch, and prerelease — returning -1, 0, or 1 with correct prerelease precedence.
25 minJavaScript - MEDIUM
Shopping Cart
Build a cart where quantity changes update line totals and a grand total live.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Shuffle / Sample Size
Implement lodash shuffle and sampleSize with an unbiased Fisher-Yates swap, taking an injectable RNG so shuffles are testable.
30 minJavaScript - MEDIUM
Signals (signal / computed / effect)
PREMIUMBuild reactive signals with automatic dependency tracking so computed values and effects update on change.
25 minJavaScript - MEDIUM
Signup Form
Build a signup form that validates user details on submit and posts them to a back-end API.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Singleflight
Implement singleflight so concurrent calls for the same key share one in-flight promise instead of duplicating work.
25 minJavaScript - MEDIUM
Singleton
Implement a Singleton class that always hands back the same instance no matter how many times you construct it.
25 minJavaScript - MEDIUM
Slugify
Turn a string into a URL-safe slug: lowercase, strip accents, and collapse non-alphanumeric runs into single hyphens.
25 minJavaScript - MEDIUM
Smallest Element in Rotated Sorted Array
Implement a function that finds the minimum value in a sorted array that has been rotated at an unknown pivot.
25 minAlgorithms - MEDIUM
Snake Game
PREMIUMBuild the classic snake game on a grid with keyboard control, growth on eating, and game over.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Socket Channel Multiplexing
Run many logical channels over one WebSocket — route each incoming frame to the right channel and clean up on leave.
35 minJavaScript - MEDIUM
Sortable List
PREMIUMBuild a list whose items reorder by dragging, with a live drop indicator.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Spreadsheet
Implement a spreadsheet class that resolves numeric cell values and evaluates simple addition formulas.
25 minJavaScript - MEDIUM
Spreadsheet II
Build a spreadsheet class that evaluates left-to-right arithmetic formulas referencing other cells.
25 minJavaScript - MEDIUM
Squash Object
Implement a function that flattens a nested object into a single-level object using dot-delimited keys.
25 minJavaScript - MEDIUM
SSE Frame Decoder
PREMIUMDecode a Server-Sent Events stream arriving in arbitrary chunks into discrete parsed events.
25 minJavaScript - MEDIUM
Stale-While-Revalidate Cache
PREMIUMReturn cached data instantly, serving stale values while revalidating them in the background.
25 minJavaScript - MEDIUM
Star Rating
Build an interactive star rating with hover preview and half-star support.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Star Rating
Build a star rating component where users click a star to set the rating shown by filled icons.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Stopwatch
Build a stopwatch widget that measures elapsed time with start, stop, and reset controls.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Streaming Chat Store Reducer
PREMIUMBuild a pure, immutable reducer that opens an assistant message, appends streamed deltas, and finalizes it.
25 minJavaScript - MEDIUM
String Anagram Groups
Implement a function that groups an array of strings so anagrams of each other end up in the same bucket.
25 minAlgorithms - MEDIUM
String replaceAll / matchAll
Implement replaceAll and matchAll — replace every occurrence of a substring or global pattern, and iterate every match with its capture groups.
35 minJavaScript - MEDIUM
String to Number (parseInt)
Reimplement JavaScript's parseInt — skip leading whitespace, read an optional sign and radix prefix, consume valid digits for the base, and stop at the first invalid character.
25 minJavaScript - MEDIUM
Styled Text Ranges II
Implement a function that overwrites the style on a given text range and normalizes the resulting range list.
25 minJavaScript - MEDIUM
Sum
Implement a curried sum function that accepts numbers one call at a time and returns the running total when invoked with none.
25 minJavaScript - MEDIUM
Sum Without Addition
Implement a function that adds two integers using only bitwise operators, without using + or -.
25 minAlgorithms - MEDIUM
Tabs
Build a tabs component that shows one panel at a time based on the currently selected tab.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Tabs II
Build a tabs component with the correct ARIA roles, states, and properties for assistive tech.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Tagged Template HTML
PREMIUMImplement an html tagged-template function that interpolates values safely into a DOM fragment.
25 minJavaScript - MEDIUM
Task Coordination
Implement a function that schedules tasks with a cooldown between identical ones and returns the minimum total time.
25 minAlgorithms - MEDIUM
Task Runner with Dependencies
Run async tasks in dependency order, executing independent ones in parallel and catching cycles.
30 minJavaScript - MEDIUM
Template Engine
Implement a template renderer that substitutes Mustache-style placeholders with values from a data object.
25 minJavaScript - MEDIUM
Test Runner
Implement a minimal test runner that registers cases, runs each one, and reports pass and fail counts.
25 minJavaScript - MEDIUM
Test Runner II
Build a small test runner that supports nested describe suites and reports tests with their full spec names.
25 minJavaScript - MEDIUM
Test Runner III
Extend a tiny test runner with beforeEach and afterEach hooks that are inherited from outer suites.
25 minJavaScript - MEDIUM
Text Search II
Implement a function that wraps every occurrence of any term from a list inside highlight markup.
25 minJavaScript - MEDIUM
The new Operator
PREMIUMImplement newOperator — reproduce the four steps the new keyword performs, honoring the object-return override.
30 minJavaScript - MEDIUM
Thousands Separator
Group a number's integer digits with separators — 1234567 to 1,234,567 — handling decimals, negatives, and a custom separator.
25 minJavaScript - MEDIUM
Throttle
Implement a function that limits how often a wrapped function can be invoked within a time window.
15 minJavaScriptGoogle · Amazon · Meta - MEDIUM
Throttle II
PREMIUMExtend throttle with cancel and flush methods plus leading and trailing edge options.
25 minJavaScript - MEDIUM
Tic-tac-toe
Build a two-player tic-tac-toe game that detects wins and draws on a 3x3 board.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Todo List
Build a Todo List component with add and delete actions, with focus on functionality over styling.
25 minUI / FrameworksGoogle · Meta · MicrosoftAngularReactHTML / CSS / JSVue - MEDIUM
Tool-Call Streaming State Machine
PREMIUMTrack streaming LLM tool calls by id, accumulating argument deltas and guarding each pending, running, and done transition.
25 minJavaScript - MEDIUM
Transfer List
Build a component that moves selected items back and forth between two side-by-side lists.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Trie (Prefix Tree)
PREMIUMImplement a Trie data structure supporting insert, exact word search, and prefix lookup operations.
25 minAlgorithms - MEDIUM
Triplet Sum
Implement a function that returns every unique triplet of distinct indices whose values sum to zero.
25 minAlgorithms - MEDIUM
Truncate String
Implement lodash truncate — cut a string to a maximum length, append an ellipsis, and optionally break on the last word boundary before the limit.
25 minJavaScript - MEDIUM
Turtle
Build a Turtle class that tracks position and heading as you issue movement and turn commands on a 2D plane.
25 minJavaScript - MEDIUM
Two-Way Binding
Wire an input and a model object so edits to either side stay in sync via events and a setter.
25 minJavaScript - MEDIUM
Type Utilities II
Implement helpers that accurately identify non-primitive JavaScript values such as arrays, plain objects, dates, and maps.
25 minJavaScript - MEDIUM
Undo / Redo Manager
PREMIUMImplement a class that tracks value history and exposes undo and redo navigation across the timeline.
25 minJavaScript - MEDIUM
Undoable Counter
Build a counter that keeps a history of values so you can undo and redo each change.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Undoable Database
Build a user database class that supports CRUD operations plus undo and redo across the operation history.
25 minJavaScript - MEDIUM
Union By
Implement a function that returns unique values across input arrays using a custom iteratee to determine identity.
25 minJavaScript - MEDIUM
Union-Find (Disjoint Set)
PREMIUMBuild a disjoint-set structure with near-constant-time union and find, using path compression and union by rank to keep the trees flat.
25 minAlgorithms - MEDIUM
Unsquash Object
Implement a function that rebuilds a nested object from a flat map of dot-delimited keys.
25 minJavaScript - MEDIUM
URLSearchParams
Implement a URLSearchParams-style class with get, getAll, append, set, and toString over an encoded query string.
25 minJavaScript - MEDIUM
useArray
Implement a hook that manages an array along with helpers to push, remove, update, and clear items.
25 minJavaScript - MEDIUM
useAsync
Implement a hook that runs an async function and tracks its status, value, and error, with a manual execute trigger.
25 minJavaScript - MEDIUM
useAsyncRetry
Implement an async hook that exposes a retry function to re-run the last operation on demand.
25 minJavaScript - MEDIUM
useBoolean II
Implement an optimized useBoolean hook whose returned setters keep stable identity across renders.
25 minJavaScript - MEDIUM
useBreakpoint
Implement a hook that returns the active responsive breakpoint name derived from the current window width.
25 minJavaScript - MEDIUM
useClickOutside
Implement a hook that fires a callback when a pointer event lands outside a referenced element.
25 minJavaScript - MEDIUM
useControllableValue
PREMIUMImplement a hook that lets one component work both controlled and uncontrolled, deciding the mode from its props.
25 minJavaScript - MEDIUM
useCookieState
Implement a useState backed by a cookie — state the server can also write, with no event when it does.
25 minJavaScript - MEDIUM
useCountdown
Implement a hook that drives a countdown timer with start, pause, and reset controls.
25 minJavaScript - MEDIUM
useDebounce
PREMIUMImplement a hook that returns a debounced version of a value, updating only after a quiet period.
25 minJavaScript - MEDIUM
useDynamicList
Implement a hook that manages a list whose items keep stable keys across inserts, removals, and reorders.
25 minJavaScript - MEDIUM
useEventCallback
Implement a hook returning a stable callback that always sees the latest props and state, avoiding stale closures.
25 minJavaScript - MEDIUM
useEventListener
Implement a hook that attaches and cleans up a browser event listener on a target element or window.
25 minJavaScript - MEDIUM
useFetch
Implement a data-fetching hook exposing data, error, and loading, that refetches when the URL changes and ignores stale responses.
25 minJavaScript - MEDIUM
useGeolocation
Implement a hook wrapping the Geolocation API to expose position, error, and loading state.
25 minJavaScript - MEDIUM
useGetState
Implement a useState variant that also returns a getter for reading the newest state from inside stale closures.
25 minJavaScript - MEDIUM
useIdle
Implement a hook that flags the user as idle after a period without keyboard, pointer, or scroll activity.
25 minJavaScript - MEDIUM
useInputControl
Implement a hook that manages a controlled input value alongside its dirty and touched flags.
25 minJavaScript - MEDIUM
useIntersectionObserver
Implement a hook that reports whether a ref'd element is intersecting the viewport via IntersectionObserver.
25 minJavaScript - MEDIUM
useInterval
Implement a hook that runs a callback on a timer with a configurable, pauseable delay.
25 minJavaScript - MEDIUM
useKeyPress
Implement a hook that returns whether a given key is currently being pressed on the keyboard.
25 minJavaScript - MEDIUM
useList
Implement a hook managing an array with immutable helpers — push, removeAt, updateAt, insertAt, clear, and set.
25 minJavaScript - MEDIUM
useLongPress
Implement a hook that fires a callback after a pointer is held down past a delay, cancelling on early release or move.
25 minJavaScript - MEDIUM
useMap
Implement a hook that wraps a JavaScript Map with set, delete, and clear helpers backed by state.
25 minJavaScript - MEDIUM
useMediaQuery
Implement a hook that returns whether a media query currently matches and updates on changes.
25 minJavaScript - MEDIUM
useMediatedState
Implement a useState-like hook that runs every incoming value through a mediator before committing it.
25 minJavaScript - MEDIUM
useMethods
Implement a hook that turns a map of state transitions into bound, stable action methods over a reducer.
25 minJavaScript - MEDIUM
useNetworkState
Implement a hook that reports online/offline status and connection info from the Network Information API.
25 minJavaScript - MEDIUM
usePagination
Implement a hook that manages page state over a total count, exposing page, pageCount, and next/prev/go with clamping.
25 minJavaScript - MEDIUM
usePreviousDistinct
Implement a hook that remembers the last value that actually differed from the current one, with a customizable comparator.
25 minJavaScript - MEDIUM
useQuery
Implement a hook that tracks the loading, data, and error states of a promise-returning request.
25 minJavaScript - MEDIUM
useQueue
Implement a hook wrapping a FIFO queue with add, remove, clear, and first/last/size accessors.
25 minJavaScript - MEDIUM
useReactive
Implement a hook whose state object you mutate directly, and reckon with what that costs React.
25 minJavaScript - MEDIUM
Users Database
Build a CRUD interface to list, filter, create, edit, and delete users backed by local state.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
useScript
Implement a hook that injects an external script tag and reports its loading status, deduping repeated sources.
25 minJavaScript - MEDIUM
useScrollPosition
Implement a hook that tracks the window scroll x/y position with a passive listener, throttled with rAF.
25 minJavaScript - MEDIUM
useSelections
Implement a hook that tracks a multi-select over a list, with an all/none/partial header state that stays honest.
25 minJavaScript - MEDIUM
useStateWithHistory
Implement a useState variant that records value history and exposes back, forward, and go over it.
25 minJavaScript - MEDIUM
useStep
Implement a hook that drives a multi-step flow with next, previous, reset, and bounded index controls.
25 minJavaScript - MEDIUM
useThrottle
PREMIUMImplement a hook that returns a throttled copy of a value, updating at most once per given interval.
25 minJavaScript - MEDIUM
useTimeout
Implement a hook that runs a callback after a given delay and cleans up when the component unmounts.
25 minJavaScript - MEDIUM
useUrlState
Implement a useState that lives in the query string, staying shareable without burying the back button.
25 minJavaScript - MEDIUM
useValidatedState
Implement a useState variant that reports whether the current value passes a validator, without an extra render.
25 minJavaScript - MEDIUM
useWhyDidYouUpdate
Implement a debugging hook that logs which props changed between renders.
25 minJavaScript - MEDIUM
Validate Binary Search Tree
Implement a function that determines whether a binary tree satisfies the binary search tree ordering invariant.
25 minAlgorithms - MEDIUM
Vector Clocks
PREMIUMOrder distributed events with vector clocks, detecting whether two events are causal or concurrent.
25 minJavaScript - MEDIUM
Virtual DOM Diff
PREMIUMImplement a diff that patches real DOM from an old vnode tree to a new one, minimizing changes.
25 minJavaScript - MEDIUM
Virtual DOM: createElement + render
PREMIUMImplement createElement to build a virtual DOM tree and render to turn it into real DOM nodes.
25 minJavaScript - MEDIUM
WebSocket Session Resume
PREMIUMResume a dropped connection without gaps — track sequence numbers, request a replay from the last seen, and de-duplicate redelivered messages.
40 minJavaScript - MEDIUM
Weighted Random Pick
Pick items at random in proportion to their weights using prefix sums and a binary search, with an injectable RNG so picks are testable.
25 minAlgorithms - MEDIUM
Whack-A-Mole
Build the arcade game where moles randomly appear in a grid and players click them to score.
25 minUI / FrameworksAngularReactHTML / CSS / JSVue - MEDIUM
Word Finder
Implement a data structure that supports adding words and searching with a wildcard character that matches any letter.
25 minAlgorithms - MEDIUM
zip / unzip
Implement zip, unzip, and zipObject — interleave arrays into tuples and back, padding ragged lengths.
25 minJavaScript