Learning Resources

Programming Exercises

Practice with real problems and instant feedback.

Basic: 182Intermediate: 235Advanced: 98
intermediatejavascript

Audit Keyboard Focus Order

From element metadata, derive the Tab order and flag positive tabindex values plus controls that are interactive but unreachable.

advancedjavascript

Test an A/B Result for Statistical Significance

Compute the relative lift and a two-proportion z-score from control and variant conversions, and flag significance at the two-sigma threshold.

intermediatejavascript

Decide When an Alert Should Fire

Evaluate a threshold rule over a metric series, requiring the threshold to be breached for a sustained number of consecutive minutes before firing.

basicjavascript

Classify an API Version Lifecycle Stage

From a version and a deprecation record (announcement and sunset timestamps), return whether the version is current, deprecated, or sunset for a given review time.

intermediatejavascript

Run an Authorization Matrix as a Test

Given the expected status code for each actor case and the statuses the endpoint actually returned, report whether the matrix passed and which cases diverged.

basicjavascript

Verify a Backup Manifest Before Restore

Compare a backup artifact with its manifest and report checksum, size and minimum-object mismatches so a restore is not attempted on an incomplete dump.

basicjavascript

Gate a Blue/Green Traffic Switch

Given the candidate environment health checks, error rate and p95 latency against thresholds, decide to switch, hold, or roll back.

basicjavascript

Check an Initial Bundle Against Budget

Sum the sizes of initial chunks, compare them with the budget, and report the largest chunk that dominates the payload.

intermediatejavascript

Decide Cache Revalidation from Headers

Parse Cache-Control directives and decide whether a conditional request returns 304, a fresh 200, or requires revalidation.

basicjavascript

Size Replicas for Peak Traffic with Headroom

Given current throughput, a peak multiplier, per-replica throughput and a headroom target, compute peak load and the number of replicas needed.

intermediatejavascript

Verify a Certificate Chain End to End

Walk a presented chain from leaf to root and report broken links, leaf expiry, and an untrusted root as sorted reason codes.

intermediatejavascript

Test Address Membership in a CIDR Block

Convert a CIDR block and a list of IPv4 addresses to integers and report which addresses fall inside the block.

basicjavascript

Parse CLI Flags and Commands

Parse argv against a flag spec, separating boolean and string flags from the command, and report unknown flags and missing values.

basicjavascript

Build a Changelog from Commit Messages

Group commit messages by type into ordered changelog sections and collect breaking changes into their own list.

basicjavascript

Validate Component Props Against a Contract

Check required props, declared types and enum values for a component invocation, returning sorted errors that name the offending prop.

intermediatejavascript

Schedule Tasks Under a Concurrency Limit

Simulate a fixed-concurrency pool: assign each task to the earliest free slot and report its start and finish time.

advancedjavascript

Own Keys on a Consistent Hash Ring

Build a consistent hash ring with virtual nodes, assign each key to the first node at or after its hash, and report per-node key counts.

intermediatejavascript

Detect Breaking Changes Between API Contracts

Compare an old and a new contract and return breaking changes: removed paths, removed response fields, and newly required request parameters.

basicjavascript

Attribute Monthly Cloud Cost by Owner

Aggregate resource costs per owning team and rank the result so each team receives an accurate, reviewable bill.

intermediatejavascript

Merge Replicas with Last-Writer-Wins

Merge key-value updates from multiple replicas using logical clocks, keeping the value with the highest clock per key and reporting conflicts.

intermediatejavascript

Find the Critical Path Through Task Dependencies

Compute the longest-duration dependency chain in a task graph and report the ordered path plus its total duration.

basicjavascript

Sum the Blocking Critical Path Against a Budget

Sum the transfer size of render-blocking resources on a page path and report whether the path exceeds its budget, listing the largest contributor.

intermediatejavascript

Count Cron Runs Inside a Window

For a simple cron minute field, count how many scheduled runs fall inside a time window and list the first runs, so overlap and load estimates are not guesses.

basicjavascript

Aggregate a CSV Stream by Group

Parse CSV text with a header row, sum a numeric column per group, and return sorted group totals.

basicjavascript

Route Exhausted Messages to a Dead Letter Queue

Given message attempt counts and a maximum, separate messages that must move to the dead letter queue from those that stay in the retry queue.

intermediatejavascript

Classify Review Risk per Changed File

Assign a review risk level to each changed file using security/config touches, test coverage presence, and change size, so a reviewer spends attention where it matters.

basicjavascript

Keep the Dependency Layer Cacheable

Inspect a Dockerfile instruction list and flag any instruction that copies application sources before the dependency install layer, which invalidates the cache on every code change.

intermediatejavascript

Group Errors by Fingerprint

Normalize volatile parts of error messages (ids, numbers, hex) and group errors into fingerprints with occurrence counts, sorted by frequency.

intermediatejavascript

Check Event Consumers Against Schema Versions

For each event version, list the consumers that accept it and flag events no consumer can accept, so a schema rollout does not silently drop messages.

intermediatejavascript

Validate Browser Extension Message Routing

Check each message against the allowed sender-to-receiver routes and report routed messages plus rejected ones with a reason.

basicjavascript

Estimate Blast Radius of a Fault Injection

From injected failure percentages per dependency and request volume, compute the affected request count and the overall failure exposure.

basicjavascript

Audit Feature Freshness Against SLAs

Compare feature update ages with their per-feature SLA and report which features are stale and by how much.

basicjavascript

Reject Uploads That Violate Policy

Check declared name, size and MIME type of an upload against a policy and return every violated rule as a sorted code.

basicjavascript

Clamp Fixed-Timestep Simulation Steps

Given a frame delta, timestep length and a maximum step count, compute how many simulation steps to run and how much delta remains.

intermediatejavascript

Bucket Users Deterministically for a Percentage Rollout

Hash each user id with a stable salt into 100 buckets and split users into enabled and disabled groups according to the configured rollout percentage.

basicjavascript

Validate a Submitted Form Server Side

Validate submitted values against required, type and length rules, returning field-level messages in a stable order.

intermediatejavascript

Find the Merge Base of Two Branches

Given commits with parent links and two branch heads, return the merge base and each branch's unique commits so a rebase plan is explicit.

advancedjavascript

Parse Arithmetic with Precedence

Parse an arithmetic expression of numbers, +, * and parentheses into an AST honouring precedence, then evaluate it.

intermediatejavascript

Check GraphQL Field Selection Against a Allowlist

Extract requested fields from a query and compare them with the allowlisted fields, reporting over-selection and unknown fields.

intermediatejavascript

Trace a Request Pipeline Until the First Failure

A request passes through an ordered pipeline (rate limit, auth, validation, handler). Report which stage blocked the request, which stages ran before it, and whether the handler ran at all.

intermediatejavascript

Evaluate an IAM Statement Against a Request

Evaluate one allow/deny statement, including wildcard actions and resource ARNs, and decide whether the request is permitted.

intermediatejavascript

Apply Requests Exactly Once by Key

Deduplicate a request batch by idempotency key, returning the applied requests, the duplicate keys, and the total charged amount.

intermediatejavascript

Find Queries Without a Usable Index

For each query, decide whether an existing index can serve its leading WHERE column and, when not, propose the column order for a new index.

basicjavascript

Route Desktop IPC Messages to Handlers

Match IPC messages to the handlers registered by the target process window and report anything that cannot be dispatched.

intermediatejavascript

Place Pods Within Node Capacity

Greedily place pods onto nodes with enough allocatable CPU and memory, and report which pods cannot be scheduled plus per-node usage.

basicjavascript

Turn Log Lines into Structured Counts

Parse key-value log lines and produce per-level counts plus a normalized message list so an incident reviewer can scan what happened.

basicjavascript

Select the Right Plural Form

Choose the plural form for English, French and Chinese from a "singular|plural" template and substitute the count.

basicjavascript

Compute Precision, Recall and F1

From ground-truth and predicted labels, compute precision, recall and F1, returning zero instead of NaN when the denominator is empty.

intermediatejavascript

Order Migrations and Detect Cycles

Topologically order migrations by their dependency declarations and report any cycle instead of emitting a half-applied plan.

basicjavascript

Size Model Replicas from Token Throughput

Convert requests per minute and tokens per request into token throughput, then compute the replicas needed at a target utilization.

basicjavascript

Route Notifications Through a Fallback Chain

For each notification, keep the primary channel when it succeeded and escalate to the next channel in the fallback chain when it failed.

intermediatejavascript

Flush an Offline Queue with Deduplication

When connectivity returns, flush queued operations in order while collapsing repeated writes to the same entity into the latest one.

basicjavascript

Lint Heading Structure in API Docs

Scan a Markdown document for heading-level jumps and duplicate headings, returning stable issue strings so documentation review catches structural breakage before publishing.

basicjavascript

Report Latency Percentiles from Raw Samples

Compute p50, p95, p99 and the mean from latency samples using nearest-rank, so tail latency is reported without hiding outliers in an average.

basicjavascript

Classify Fields by Data Sensitivity

Given sampled field values, label each field as email, payment-card, government-id, date-of-birth, or none, so downstream storage and retention rules can be applied.

intermediatejavascript

Select Affected Packages for a Build

From changed file paths and the package layout, return every package that must be built: those owning changed files plus all reverse dependents, sorted.

intermediatejavascript

Fit a Conversation Into a Token Budget

Reserve output tokens, then keep the newest conversation messages that fit the remaining context window, reporting which were dropped and what remains.

basicjavascript

Score Prompt Outputs Against a Rubric

Evaluate candidate outputs against a rubric of required substrings and a length ceiling, returning pass/fail plus the failed criteria per output.

basicjavascript

Refill a Token Bucket Correctly

Implement the token-bucket decision for one request: refill tokens for the elapsed time up to capacity, then allow the request only when enough tokens remain after paying the cost.

intermediatejavascript

Track Reactive Dependencies per Key

Simulate read/write operations on a reactive proxy and record which effects depend on each key plus the final values.

basicjavascript

Apply a State Reducer Without Mutation

Apply a sequence of actions to a state object with a pure reducer, where unknown actions leave state unchanged.

intermediatejavascript

Measure Replica Lag from Sequence Gaps

Convert primary/replica sequence gaps into seconds using write throughput and report samples whose lag exceeds the threshold.

basicjavascript

Select Records Past Their Retention Window

Apply per-category retention periods to a batch of records and return the ids that must be deleted, sorted for a deterministic deletion plan.

intermediatejavascript

Rank Documents by Cosine Similarity

Compute cosine similarity between a query vector and document vectors, then return the top-k document ids with their scores.

basicjavascript

Compute an Exponential Backoff Schedule

Generate the delay before each retry using exponential growth, capped at a maximum, and report the total waiting time.

basicjavascript

Simulate a Ring Buffer Overwrite

Given a fixed capacity and a write sequence, return the buffer contents plus how many writes overwrote older data.

intermediatejavascript

Rank Route Patterns by Specificity

Given a set of registered route patterns and one incoming request path, return the pattern that should handle it: static segments beat parameter segments, which beat wildcard segments.

intermediatejavascript

Propagate an RPC Deadline Across Hops

Subtract per-hop overhead from a request deadline and report the remaining budget at each hop, marking when the deadline is exceeded.

basicjavascript

Validate a Payload Against a Field Schema

Check required fields and declared types in a request payload and return sorted error codes, including the field name in every code.

basicjavascript

Extract Allowlisted Links from HTML

Extract anchor hrefs and their visible text from an HTML fragment, keep only allowlisted hosts, and report how many links were skipped.

advancedjavascript

Rank Documents with Term Frequency and IDF

Score documents for a multi-term query using summed term frequency weighted by inverse document frequency, then return the ranked ids.

intermediatejavascript

Redact Secrets Before Logging

Mask API keys, access key ids and key-value credentials in a log line while keeping the surrounding diagnostic text intact.

basicjavascript

Clean Up Resources on Signal

Given acquired resources in order and a terminating signal, return the reverse-order cleanup list and the conventional exit code.

intermediatejavascript

Spend an Error Budget Without Guessing

From total requests, failed requests and an SLO target, compute the allowed failure count, how much of the budget is consumed, what remains, and the daily allowance.

intermediatejavascript

Reconstruct a Trace from Span Records

Build the span tree from parent references, list root spans with child counts and durations, identify the slowest root, and report spans whose parent is missing.

basicjavascript

Compute a Running Total per User

Given transaction rows, produce per-user running totals ordered by day, matching what a SQL window function with PARTITION BY user ORDER BY day returns.

basicjavascript

Encode Server-Sent Events Correctly

Serialize event records into the SSE wire format with id, event type and data lines, terminated by a blank line, and join frames in order.

intermediatejavascript

Audit Lockfile Entries for Supply Chain Gaps

Scan resolved dependency entries for missing integrity hashes and plaintext HTTP tarball URLs, and return stable violation strings for the build report.

intermediatejavascript

Detect Configuration Drift as Paths

Compare declared configuration with observed state, flatten nested objects into dotted paths, and list every drifted path in sorted order.

basicjavascript

Generate a Test Matrix with Exclusions

Expand browser, operating system and locale dimensions into a combination matrix, remove explicitly unsupported pairs, and report the totals plus a sample of selected cases.

intermediatejavascript

Map Threats to STRIDE Categories

Classify each threat statement into a STRIDE category using the dominant signal in the description, and mark anything unrecognized as unclassified.

intermediatejavascript

Validate Token Claims Against a Policy

Check a decoded token payload against a validation policy and return a sorted list of violation codes covering expiry, not-before, maximum token age, audience, and issuer.

intermediatejavascript

Resolve the Best Version for Constraints

Evaluate caret, tilde, range and comparison constraints against candidate versions and return the highest satisfying version plus the satisfying set.

intermediatejavascript

Deduplicate Events Inside a Time Window

Process a timestamp-ordered event stream and keep only the first event per window, reporting dropped duplicates.

basicjavascript

Decide WebSocket Reconnect from Heartbeat Misses

Given heartbeat interval, consecutive missed pongs and a threshold, decide whether to keep the connection, send another ping, or reconnect.

intermediatejavascript

Base32 Encoder and Decoder

Implement RFC 4648 base32 encode and decode over UTF-8 bytes, including correct padding, and verify the round trip restores the original text.

intermediatejavascript

Bitmap Index with AND Queries

Build per-value bitmap indexes over row fields and answer conjunctive queries by ANDing bitmaps, reporting matching row indexes.

intermediatejavascript

Bloom Filter with Double Hashing

Build a fixed-size bloom filter using FNV-1a double hashing, insert items, and report the bitset plus membership answers including a possible false positive.

intermediatejavascript

Bloom Filter False Positive Rate

Compute the theoretical false positive rate of a bloom filter from its bit count, hash count, and inserted item count using the standard closed-form formula.

advancedjavascript

Consistent Hashing Ring with Virtual Nodes

Place nodes and their virtual replicas on a hash ring, resolve keys clockwise, and report which physical node owns each key.

intermediatejavascript

CRC-32 Checksum with Table Lookup

Compute the CRC-32 (IEEE 802.3, reflected polynomial) checksum of UTF-8 text using a generated 256-entry table and report it as uppercase hex.

intermediatejavascript

CSV Line Parser with Quoted Fields

Parse CSV lines handling quoted fields, embedded commas, escaped double quotes, and trailing empty fields, returning header and rows as arrays.

advancedjavascript

Line Diff via Longest Common Subsequence

Diff two line arrays with an LCS dynamic program and emit a unified-style script of kept, removed, and added lines with the LCS length.

basicjavascript

Fixed-Window Rate Limiter

Track per-window request counters keyed by floor(timestamp / window) and decide which request IDs pass the limit and which are rejected.

basicjavascript

Hex Dump Formatter

Format arbitrary text as a hexdump: 8-digit offsets, sixteen bytes per row of hex pairs, and a printable-ASCII gutter.

advancedjavascript

Histogram Quantile with Linear Interpolation

Answer quantile queries over a fixed-boundary histogram by linearly interpolating inside the bucket that contains the target rank, as Prometheus does.

basicjavascript

Merging Overlapping Intervals

Sort closed intervals by start and merge every overlapping or touching pair into a single interval, outputting the minimal disjoint cover.

intermediatejavascript

JSONPath Subset Query Engine

Evaluate a small JSONPath dialect over nested objects: dot segments, numeric indexes, and the star wildcard, returning scalars or arrays of matches.

basicjavascript

Deterministic Log Sampling

Sample log lines by hashing each line identifier with FNV-1a and keeping lines whose hash modulo 100 falls below the keep percentage.

intermediatejavascript

LRU Cache with Eviction Log

Implement an O(1) least-recently-used cache over a put/get operation stream and report every get result plus the order in which keys were evicted.