Lab · Puzzles
Coding puzzles you can watch.
45 problems in JavaScript. Your code sorts the bars, paints the canvas, walks the maze or builds a piece of a model, and the stage plays it back. Solve one signed in and the server checks it against hidden tests and keeps your time, for you only.
This week's canvasPaint one tile with a few lines of code. Everyone's tiles make one wall, live.Classics
The interview standards: arrays, strings, maps, graphs. Watch your algorithm move.
Bubble up
The slowest sort there is, and the best one to watch.
Two receipts
Two receipts in the pile add up to the refund. Find them in one pass.
Bracket check
Your editor turns a file red when one bracket never closes. Be that check.
Empty jars to the back
Shelve the empty jars at the back without reshuffling the full ones.
Guess the page
Find any page in a 1,000 page book in ten guesses or fewer.
The best stretch
A month of daily profit and loss. Find the stretch of days you most wish you had been open.
Busy blocks
Squash an overlapping calendar into the blocks of time you are actually busy.
No repeats
Type the longest run of characters you can without hitting the same key twice.
Paint bucket
The paint bucket from every drawing app, one cell at a time.
Count the islands
A satellite map of an archipelago. Count the islands without counting any of them twice.
A quarter turn
Turn a picture a quarter turn clockwise, the way your phone does when you tip it.
Way out of the maze
Drop a ripple at the entrance and let it find the shortest way out.
Exact change
A vending machine owes you change. Pay it out in as few coins as possible, and find out where greedy goes wrong.
Quiet queens
Eight queens on one chessboard, and not one of them allowed to see another.
Rain on the rooftops
Rain falls on a row of buildings. How much water is left sitting between them once it stops.
Visual
Your function paints, grows or simulates. The tests check it; the stage shows it.
Rings
One line of maths, and the canvas fills with ripples.
Checkerboard
Two floors and a remainder make the oldest pattern on any table.
Sierpinski in one AND
A famous fractal is hiding inside the bits of two coordinates.
Soft glow
A light in the middle of the canvas that fades out to the edge.
Lissajous figure
Two sine waves at different speeds trace a knot that loops back on itself.
The Mandelbrot set
Square a number, add a constant, repeat. Some points never get away.
Colour wheel
Angle becomes hue, distance becomes saturation, and the disc turns into a rainbow.
Plasma
Add four sine waves, push the sum through three more, and the canvas starts to look molten.
Rule 30 and friends
Eight bits of a rule number grow a whole world, one row at a time.
Game of Life
Four rules about neighbours, and gliders start walking across the grid.
A seeded random walk
A drunk ant that is perfectly repeatable, because you chose its dice.
Langton's ant
Two rules, ten thousand steps of mess, then the ant builds a highway.
Sandpile
Pour grains on one cell, let every tall stack topple, and a mandala appears.
Maze carver
Walk forward until you are stuck, back up, try again: a perfect maze every time.
Dragon curve
Fold a strip of paper in half again and again, open it to right angles, and a dragon unfolds.
AI from scratch
Build the small pieces inside a model by hand: softmax, tokens, neighbours, attention.
Softmax
How a model turns raw scores into odds for its next word.
Turn up the temperature
One dial decides whether a model plays it safe or takes a chance.
Split into words
Before a model reads anything, the text gets chopped into pieces.
How alike are two words
Words become arrows, and the angle between them says how related they are.
Mean squared error
The one number a model is trying to push down while it learns.
Keep the top k
Cut off the long tail of unlikely words before picking the next one.
Nearest word
Ask a tiny embedding table which word sits closest to an idea.
Roll downhill
Watch the error fall as a line nudges itself toward the data.
Precision and recall
Two honest numbers for how a yes-or-no model actually behaves.
No peeking ahead
Why a model writing word five is not allowed to see word six.
Find the right page
The retrieval half of RAG, built from nothing but word overlap.
Byte pair merges
How real tokenizers invent their own word pieces from raw letters.
Ask the neighbours
Classify a new point by asking the k closest points what they are.
Where should I look
The core move inside a transformer, worked out for one word.
Teach a neuron AND
One artificial neuron learns a rule from examples, one mistake at a time.
Solving now
Verified solves show up here the moment the server checks them.