Visualize — watch it run

Reading about a sliding window teaches you the words. Watching one move teaches you the idea. Every visualization here steps through real execution — you control the pace.

299 visualizations5 familiesVerified against real execution

Start here

Interactive labYOU CAN PLAY WITH THIS
Binary Search Lab — hunt for YOUR number
Type six numbers and a target — then watch half the possibilities die with every single comparison.
Watch it run
Interactive labYOU CAN PLAY WITH THIS
Coin Change Lab — race the table against greedy
Pick your own coins and amount, watch the DP ladder fill — and catch grab-the-biggest paying more than it had to.
Watch it run
Interactive labYOU CAN PLAY WITH THIS
Sliding Window Lab — run it on YOUR numbers
Type any four numbers and a target, then watch the real algorithm hunt for the shortest window through them.
Watch it run
Step-through
Sliding Window — longest stretch with no repeats
Watch the window stretch to the right, hit a repeat, shrink from the left, and carry on.
Watch it run

Pattern Cinema

Sliding Window (variable size)
Two markers that only ever move forward.

Browse all

Step-through
The Memory Machine Takes a Quiz
Seven flats studied, three hidden — watch a memorizer ace train and fail test.
Watch it run
Step-through
Eight Dots Vote on r
Watch covariance votes pile up and become Pearson's r = 0.996.
Watch it run
Step-through
The Ball That Rolls Downhill
Watch a ball hop down f(x) = (x-3)² + 2, steered only by the slope under it.
Watch it run
Step-through
The Line That Learns
Eight dots tug on a line — watch gradient descent tilt it, then lift it.
Watch it run
Step-through
The Next-Token Loop
A tiny word-counting model writes a sentence one guessed word at a time — exactly how big chat AIs write, just smaller.
Watch it run
Step-through
The Rule That Finds Itself
Nine candidate cut-offs audition on eight students — the least-wrong one becomes the model.
Watch it run
Growth curves
Asymptotic Analysis — Comparing Growth
Big-O is the worst case; here is the family of curves it talks about.
Watch it run
Step-through
Backtracking — Watch the Tree Get Pruned
Pick weights from {5, 4, 3} that total exactly 7 kg — and watch over-heavy branches die before they grow.
Watch it run
Step-through
Divide and Conquer — Levels of Work
Merge sort with a level counter: every level of the tree touches every box once.
Watch it run
Step-through
Greedy — Book the Event That Ends First
One rule, one pass: take it if it fits, never look back.
Watch it run
Growth curves
Recurrences — Where Each One Lands
Same template T(n) = aT(n/b) + f(n); wildly different curves depending on a vs b^d.
Watch it run
Step-through
1D Arrays — A Row of Boxes
A pointer i walks the boxes left to right while sum collects every value.
Watch it run
Step-through
2D Arrays — A Table of Numbers
Watch a nested loop visit every cell, row by row.
Watch it run
Step-through
Binary Tree — Build It, Then Walk It Inorder
malloc five nodes, wire them with pointers, and visit them left, me, right.
Watch it run
Step-through
Bitwise Operations in C
Peek inside 12 (1100) and 10 (1010) as &, |, ^, << and >> work on their bits.
Watch it run
Step-through
argc & argv — Words After the Name
Run with no extra words: argc is still 1, because the program's own name counts.
Watch it run
Step-through
Dynamic Memory — malloc & free
Borrow 3 boxes from the heap at run time, fill them, and give them back.
Watch it run
Step-through
File Handling — Open, Use, Close
Write a line into notes.txt, close it, open it again, and read the line back.
Watch it run
Step-through
A Pointer That Points at a Function
op aims at add, calls it, then re-aims at mul — and the same op(3, 4) gives a different answer.
Watch it run
Step-through
Defining & Calling a Function
Watch control jump from main into add(), copy 3 and 4 into a and b, and come back carrying 7.
Watch it run
Step-through
Making Decisions with if-else & switch
Watch the false checks get skipped, the true branch win, and break stop the switch fall-through.
Watch it run
Step-through
Your First C Program
Watch C start at main, say hello, and add a few fruits together, one line at a time.
Watch it run
Step-through
Linked List — Build the Chain Yourself
malloc each node, wire the next pointers by hand, then walk 10 → 20 → 30.
Watch it run
Step-through
Adding Numbers with a for Loop
Watch i climb from 1 to 5 and the total box grow as we add each number.
Watch it run
Step-through
Memory Management — Stack vs Heap
The stack cleans itself; the heap is on you — free it, then NULL the pointer.
Watch it run
Step-through
Star Patterns — Drawing with Loops
Watch a nested loop light up the board, one star at a time.
Watch it run
Step-through
C Operators
Watch +, -, *, /, % and > work on 10 and 3 — and see why 10 / 3 is just 3.
Watch it run
Step-through
Pointer Arithmetic — Hopping Box by Box
p++ slides the pointer one whole box forward; *(p+2) peeks two boxes ahead.
Watch it run
Step-through
arr[i] Is *(arr + i) in Disguise
Watch both spellings open the same boxes of [3, 7, 9] and print identical values.
Watch it run
Step-through
Pointers — Address & Dereference
p remembers WHERE x lives — watch *p = 99 change x without touching its name.
Watch it run
Step-through
swap() That Actually Works — Call by Reference
main hands swap the addresses &x and &y, so swap reaches back and really trades 3 and 8.
Watch it run
Step-through
#define: Find and Replace Before Compiling
Watch PI and SQUARE(x) get swapped for real text before the program ever runs.
Watch it run
Step-through
printf & scanf — Talking with the User
Watch scanf pick up each line we type and printf show it back on screen.
Watch it run
Step-through
Queue in C — An Array + Front & Rear
Enqueue 5, 8, 9 at the rear, then dequeue twice from the front.
Watch it run
Step-through
Recursion — The Call Stack
Watch factorial(4) pile up stack frames, then unwind them into 24.
Watch it run
Step-through
A Struct That Points at Its Own Kind
Hook node a to node b with a.next = &b, then walk the chain with a pointer — the seed of every linked list.
Watch it run
Step-through
Bubble Sort — The Three-Line C Swap
Neighbours get compared; the bigger one bubbles right via temp.
Watch it run
Step-through
Stack in C — An Array + a Top Counter
Push 10, 20, 30 onto the pile, peek at the top, then pop twice.
Watch it run
Step-through
static vs Normal: The Box That Remembers
Call the same function 3 times — the static box counts 1, 2, 3 while the normal box resets every time.
Watch it run
Step-through
The <string.h> Toolbox
Copy "sun", glue on "shine", measure it, then compare cat vs dog.
Watch it run
Step-through
C Strings — Letters in Boxes (plus a Secret One)
A string is a char array with a hidden \0 marking the end.
Watch it run
Step-through
A Struct: One Box with Compartments
Build a Student box, fill s.name and s.marks with the dot operator, then change just the marks.
Watch it run
Step-through
Type Casting: Saving the Lost Fraction
See 7/2 lose its .5, a (float) cast rescue it, and (int)9.8 get chopped to 9.
Watch it run
Step-through
Typedef in C
Give a long type a short nickname, then use it like a real word.
Watch it run
Step-through
Unions & Enums in C
Names for numbers, and one memory box wearing two labels.
Watch it run
Step-through
C Variables & Data Types
Watch three typed boxes get filled, then printed with %d, %.1f and %c.
Watch it run
Step-through
2-SAT — Satisfiability with SCCs
Turn each "A or B" rule into if-then arrows and check for contradictions.
Watch it run
Step-through
Selection Sort — Pick the Smallest
Each pass finds the smallest leftover number and swaps it into place.
Watch it run
Step-through
Two Sum — The #1 Array Interview Question
One pass, a hash map remembers each number so its partner finds it instantly.
Watch it run
Step-through
Arrays — Boxes in a Row
See how an array stores values and how we pick one out by its index.
Watch it run
Step-through
Kadane's Algorithm — Biggest Block Sum
Slide along once, keeping a running sum and the best sum seen so far.
Watch it run
Step-through
Prefix Sums — Running Totals
Replace each value with the total of everything up to it.
Watch it run
Step-through
Linear Search — Checking Each Box
Watch the pointer scan the array until it finds the number we want.
Watch it run
Step-through
Sliding Window — A Moving Frame
A window of 3 boxes slides across, keeping its sum without re-adding.
Watch it run
Step-through
Bubble Sort — Swapping Neighbours
Compare two boxes at a time; the biggest numbers bubble to the end.
Watch it run
Step-through
Array Traversal — Visiting Every Box
A pointer walks left to right, adding each value to a running total.
Watch it run
Step-through
Two Pointers — Reversing an Array
Two pointers start at the ends and swap their way to the middle.
Watch it run
Step-through
Articulation Points & Bridges
One DFS finds every single point of failure — using each node's disc and low.
Watch it run
Step-through
Backtracking — Choose, Explore, Un-choose
Watch the choice path grow and shrink as we find every subset of [1, 2].
Watch it run
Step-through
Bellman-Ford — Cheapest Routes with Negative Roads
Re-check every road V-1 times; even a -1 road gets counted right.
Watch it run
Step-through
Breadth-First Search (BFS)
Explore a graph level by level — nearest nodes first — using a queue.
Watch it run
Step-through
Maximum Bipartite Matching (Kuhn’s)
Pair workers with jobs so nobody shares — re-routing to fit in one more pair.
Watch it run
Step-through
Binary Search Tree — Finding a Number
Walk down the tree, going left for smaller and right for bigger, until you find 6.
Watch it run
Step-through
Counting Connected Components
A graph can be in separate pieces — walk from each unseen node and count the islands.
Watch it run
Step-through
Depth-First Search (DFS)
Dive deep down one path, then backtrack — using recursion and a visited set.
Watch it run
Step-through
Doubly & Circular Linked Lists
Walk the chain forward with next, backward with prev — then bend it into a ring.
Watch it run
Step-through
1-D DP — Tabulation
Climbing stairs: the dp row fills left to right, each cell from the two before it
Watch it run
Step-through
Grid DP — 2-D Tables
Unique paths on a 3×4 grid: the table fills row by row, each cell = top + left
Watch it run
Step-through
DP — Memoization
fib(6) with an answer notebook: every subproblem solved exactly once
Watch it run
Step-through
0/1 Knapsack — Take or Skip
Items (2,3)(3,4)(4,5), capacity 5: each cell picks the better of skip vs take
Watch it run
Step-through
Longest Increasing Subsequence
Each dp cell looks back at smaller earlier values and extends the best run
Watch it run
Step-through
String DP — LCS
LCS of "ACE" and "ABCDE": match extends the diagonal, mismatch takes the best neighbour
Watch it run
Step-through
Eulerian Path & Circuit
Walk every edge exactly once — draw the whole shape without lifting your pen.
Watch it run
Step-through
Fenwick Tree (BIT) — Fast Prefix Sums
Each slot covers a power-of-two block; the i & -i trick jumps to just the slots you need.
Watch it run
Step-through
Graphs — Nodes & Edges
A web of nodes joined by edges; each node has a list of neighbours.
Watch it run
Step-through
Graph Representations — List vs Matrix
Store one graph two ways: neighbour lists and a grid of 0/1 — and watch them agree.
Watch it run
Step-through
Hamiltonian Path (Backtracking)
Visit every node exactly once — try a path, and back up when you get stuck.
Watch it run
Step-through
What is DSA? — Finding the Biggest Number
A row of boxes (data structure) plus a step-by-step scan (algorithm) finds the max.
Watch it run
Step-through
Reversing a Linked List — The Three-Pointer Walk
Walk once, flipping each next arrow to point backward with prev / curr / nxt.
Watch it run
Step-through
Cycle Detection — Floyd's Tortoise & Hare
A slow and a fast pointer race around the list — if they meet, there is a loop.
Watch it run
Step-through
Sorting a Linked List — Bubble Sort
Compare neighbour nodes and swap the out-of-order ones until the chain is sorted.
Watch it run
Step-through
Linked Lists — A Chain of Nodes
Each node points to the next; a pointer walks from head to null.
Watch it run
Step-through
Kruskal's Algorithm — Cheapest Network
Sort roads by cost; take one only if it joins two different groups.
Watch it run
Step-through
Max Flow — Filling the Pipes (Edmonds-Karp)
Find a path with spare room, push water through it, repeat until none is left.
Watch it run
Step-through
Min-Heap with heapq — Smallest on Top
Push numbers in any order; the heap always keeps the smallest at the top.
Watch it run
Step-through
Deque — Add and Remove at Both Ends
append/pop at the rear, appendleft/popleft at the front.
Watch it run
Step-through
Queues — First In, First Out
Join at the rear, leave from the front — like a line at a shop.
Watch it run
Step-through
Recursion — The Call Stack
Watch factorial(4) pile up calls, then unwind them into 24.
Watch it run
Step-through
Red-Black Tree — Balancing with Colours
Insert 10, 20, 30 — two reds collide, then a rotation and recolor set it right.
Watch it run
Step-through
Segment Tree — Range Sums in a Few Steps
Each node remembers the sum of a range, so a big query is just a few precomputed pieces.
Watch it run
Step-through
Dijkstra's Algorithm — Cheapest Routes
Always settle the nearest unsettled node; update prices through it.
Watch it run
Step-through
Singly Linked Lists — Adding a Node
Walk a pointer to the last node, then attach a new one.
Watch it run
Growth curves
Space Complexity — How Much Memory?
The same Big-O idea, but for extra memory instead of time.
Watch it run
Step-through
Balanced Brackets with a Stack
Push every "(" on the pile and pop one off for each ")".
Watch it run
Step-through
Stacks — Last In, First Out
Push items onto the top, then pop them off the top.
Watch it run
Step-through
Next Greater Element with a Monotonic Stack
Numbers wait on a pile until a bigger one arrives — then they pop with their answer.
Watch it run
Step-through
Reverse a String In Place
Two markers swap letters from both ends until they meet in the middle.
Watch it run
Step-through
Naive String Matching — Sliding the Pattern
Slide a little pattern across the text and compare letters until it fits.
Watch it run
Step-through
Palindromes — Two-Pointer Check
One marker at each end walks inward, comparing letters as it goes.
Watch it run
Step-through
KMP Search — Jump, Never Backtrack
Watch KMP find "ABA" inside "ABABABA" without ever re-checking a letter.
Watch it run
Step-through
Rabin-Karp — Slide a Hash, Then Verify
Watch each window of "ABAB" become a number we compare before checking letters.
Watch it run
Step-through
Reading Regex Patterns
Learn what \d+ and [a-z]+ really say — pull numbers from a log line, then shape-check a word.
Watch it run
Step-through
Strings — A Row of Letters
See how a string lines up its characters and how we pick or loop over them.
Watch it run
Step-through
Kosaraju's Algorithm — Strongly Connected Components
Two deep walks and a flip of every arrow reveal the knots in a directed graph.
Watch it run
Growth curves
Big-O — How Fast Does Work Grow?
Step through the 7 must-know growth curves, from flat to explosive.
Watch it run
Step-through
Topological Sort — Kahn's Algorithm
Line up tasks so every "must come before" arrow is respected.
Watch it run
Step-through
Travelling Salesman — Try Every Route
With few cities, brute force every tour and keep the cheapest.
Watch it run
Step-through
AVL Tree — Rebalancing with a Rotation
Insert 10, 20, 30 — the tree tips over, then one left rotation stands it back up.
Watch it run
Step-through
Inorder Tree Traversal — Left, Node, Right
Walk a binary tree in the order: left side, the node, then right side.
Watch it run
Step-through
Trees — Roots, Children & Leaves
Meet the parts of a binary tree, from the root down to the leaves.
Watch it run
Step-through
Trie — A Tree of Letters
Insert cat, car and dog into a prefix tree, then search for car (found) and cow (not found).
Watch it run
Step-through
Trie Autocomplete — Words That Share a Start
Insert cat, car, cart and dog, then list every word beginning with 'ca'.
Watch it run
Commit graph
Branches are movable pointers
Watch how creating, switching, and committing move the branch and HEAD labels.
Watch it run
Git flow
Ignoring files with .gitignore
Ignored files vanish from status — but only if they were never tracked.
Watch it run
Git flow
init → add → commit
Follow a file from your folder, through staging, into Git history.
Watch it run
Git flow
Installing & Setting Up Git
Install Git once, then tell it your name and email so every commit is signed by you.
Watch it run
Git flow
What Is Version Control?
A save-game system for your code — every commit is a snapshot you can return to.
Watch it run
Commit graph
Merging branches and resolving conflicts
Fast-forward when history is a straight line, a three-way merge commit when it has diverged.
Watch it run
Commit graph
Rebase replays commits onto a new base
Watch feature's commits get recreated on top of main for a clean, linear history.
Watch it run
Commit graph
Remotes: clone, fetch, pull, push
Watch your local main and origin/main drift ahead / behind, then re-sync.
Watch it run
Commit graph
git bisect — finding the commit that broke it, by halving
Watch HEAD jump to the middle of history, then to the middle of what is left, until one commit is left standing.
Watch it run
Commit graph
Detached HEAD — how work gets stranded, and how to save it
Watch a commit land on no branch at all, then get rescued with a branch name.
Watch it run
Commit graph
--force vs --force-with-lease — the flag that saves a teammate's work
Watch a teammate's commit arrive, then watch --force-with-lease refuse to destroy it.
Watch it run
Commit graph
"I deleted the branch with my work on it"
Watch a branch disappear, its commit go unreachable, and both come back with one command.
Watch it run
Commit graph
"I lost my work with reset --hard" — getting it back
Watch a commit fall off the branch, sit there unreachable, and get rescued by reflog.
Watch it run
Commit graph
reset vs revert — the same undo, two very different histories
Watch reset erase a commit from one branch while revert cancels it out on another.
Watch it run
Commit graph
Squashing messy commits into one clean commit
Watch three "wip" commits collapse into a single commit worth reviewing.
Watch it run
Commit graph
git worktree — two folders, one repository
Watch a second working directory appear so an urgent fix can happen without stashing anything.
Watch it run
Commit graph
"I committed to main by mistake" — moving it to a branch
Watch a branch pointer be planted on the commit before main is rolled back off it.
Watch it run
Commit graph
Stashing: shelve work, switch freely
Watch the stash stack grow then shrink as you park uncommitted work and move between branches.
Watch it run
Git flow
status → diff → log: staying oriented
See how the three read-only commands map onto working / staging / repository.
Watch it run
Git flow
Undoing changes safely
restore discards a change; revert adds a commit that reverses another.
Watch it run
Commit graph
The Pull-Request workflow
The full professional loop: branch, commit, push, open a PR, review, squash-merge, clean up.
Watch it run
Step-through
Java 8 Features Working Together
A lambda prints each number, a stream sums the odds, and an Optional finds the biggest.
Watch it run
Step-through
Abstraction — a Promise Filled In Later
Watch an abstract Shape promise an area, and a real Circle keep that promise.
Watch it run
Step-through
Java Arrays — Adding Up the Boxes
A pointer walks across an int array, adding each value to a running total.
Watch it run
Step-through
Growing & Shrinking an ArrayList
Watch the row of boxes change after each add, get, size, and remove.
Watch it run
Step-through
Storing Things by Name with a HashMap
Watch the name-to-age lockers fill up, get updated, and then be looked up.
Watch it run
Step-through
Stack vs Queue — LIFO vs FIFO
Push the same three words into a stack and a queue, then watch them come out in opposite orders.
Watch it run
Step-through
Sorting With a Comparator
Watch a comparator rule put a list of scores in order from highest to lowest.
Watch it run
Step-through
Constructors — Building a Student
Watch the constructor run when new Student(...) is called, filling the name and marks fields.
Watch it run
Step-through
Choosing a Grade with if-else
Watch the if-else ladder test the score from the top and pick the grade.
Watch it run
Step-through
The Singleton Pattern
Watch two requests for the printer hand back the exact same object — one shared instance.
Watch it run
Step-through
Encapsulation: Protecting Private Data
Watch a private balance change only through deposit, withdraw, and getBalance.
Watch it run
Step-through
Catching Errors with try / catch / finally
Watch control jump from the failing line to catch, while finally runs no matter what.
Watch it run
Step-through
Writing a File, Then Reading It Back
Watch notes.txt get created and filled, then flow back into a list when Java reads it.
Watch it run
Step-through
Generics — One Box, Any Type
Watch one Box<T> hold a number, then the SAME code hold a word.
Watch it run
Step-through
Inheritance, @Override & super
Watch which speak() runs — the parent for Animal, the override for Dog reaching up with super.
Watch it run
Step-through
Your First Java Program
Watch Java start up, say hello, and add a few fruits together, one line at a time.
Watch it run
Step-through
Java Lambda Expressions
Watch two tiny arrow-functions get built once and then called to add numbers and test for even.
Watch it run
Step-through
Adding Numbers with a for Loop
Watch i climb from 1 to 5 and the total box grow as we add each number.
Watch it run
Step-through
Math & Random
Use Java's built-in Math helpers and roll a dice with a fixed seed so the answer is the same every time.
Watch it run
Step-through
Picking the Right add() — Method Overloading
Two methods named add. Watch Java choose add(int, int) for whole numbers and add(double, double, double) for decimals.
Watch it run
Step-through
Defining & Calling a Method
Watch control jump into square(), copy the value into n, return an answer, and come back.
Watch it run
Step-through
Multithreading: Many Helpers at Once
Build 4 threads, start() them together, then join() to wait — 4000 adds, every time.
Watch it run
Step-through
Classes & Objects — Building a Dog
Watch a Dog object get born from the class, fill its boxes, then bark.
Watch it run
Step-through
Java Operators & Expressions
Watch +, /, %, > and && turn two numbers into maths and yes/no answers.
Watch it run
Step-through
Public vs Private: Who Can Touch What
A public name anyone can read, and a private marks you can only reach through a public helper.
Watch it run
Step-through
Polymorphism: One Call, Many Forms
Watch one line — a.sound() — run the Dog's code, then the Cat's code.
Watch it run
Step-through
Recursion: A Method That Calls Itself
Watch factorial(4) dive down to 0, then climb back up multiplying the answer together.
Watch it run
Step-through
Reading Input with Scanner
See how a Java program reads the number and word we type in, one at a time, and prints them back.
Watch it run
Step-through
Streams: Filter, Map, Collect
Watch numbers ride a conveyor belt that keeps the evens, squares them, and adds them up.
Watch it run
Step-through
Handy Tools for Text
Watch six String methods work on one fixed line of text, each making a new answer.
Watch it run
Step-through
Working With Strings
Watch a word get measured, snipped, and joined to make new text.
Watch it run
Step-through
Synchronization: Take Turns, Lose Nothing
Four threads add to one box. "synchronized" makes them take turns — the total is always 4000.
Watch it run
Step-through
Java Variables & Data Types
Watch five boxes get filled with different kinds of values, then printed one by one.
Watch it run
Step-through
Wrapper Classes: Boxing & Unboxing
Watch plain numbers hop into object boxes and back, and see text turn into numbers.
Watch it run
Class diagram
Behavioral Patterns — Observer
A Channel notifies a list of Subscribers on upload — add a fan type without touching it
Watch it run
Class diagram
Creational Patterns — Factory Method
A checkout welded to `new UpiPayment()` becomes a factory that returns a Payment abstraction
Watch it run
Class diagram
Structural Patterns — Decorator
Coffee add-ons: wrap a Beverage in decorators instead of subclassing every combination
Watch it run
Class diagram
Design Library Management — LLD Walkthrough
Grow the design from Account/Member out to the Book-vs-BookItem split and the BookLending record
Watch it run
Class diagram
Design a Parking Lot — LLD Walkthrough
Grow the class design from Vehicle & ParkingSpot out to the Lot hierarchy and the Ticket
Watch it run
Class diagram
SOLID — Dependency Inversion
OrderService stops depending on a concrete EmailSender and depends on an abstraction instead
Watch it run
Interactive labYOU CAN PLAY WITH THIS
Binary Search Lab — hunt for YOUR number
Type six numbers and a target — then watch half the possibilities die with every single comparison.
Watch it run
Interactive labYOU CAN PLAY WITH THIS
Coin Change Lab — race the table against greedy
Pick your own coins and amount, watch the DP ladder fill — and catch grab-the-biggest paying more than it had to.
Watch it run
Interactive labYOU CAN PLAY WITH THIS
Sliding Window Lab — run it on YOUR numbers
Type any four numbers and a target, then watch the real algorithm hunt for the shortest window through them.
Watch it run
Step-through
Sliding Window — longest stretch with no repeats
Watch the window stretch to the right, hit a repeat, shrink from the left, and carry on.
Watch it run
Step-through
Sliding Window — smallest run that reaches the target
Watch the window grow until the total is big enough, then squeeze from the left to make it smaller.
Watch it run
Step-through
Counting evens and odds — two tally boxes, one walk
Watch each number send its vote to one of two counters.
Watch it run
Step-through
Highest mark in the class — one pass, one champion
Watch the pointer walk the list once while the best-so-far only ever climbs.
Watch it run
Step-through
Linear search — checking every seat until you find the roll number
Watch the pointer stop dead the moment it finds a match.
Watch it run
Step-through
Reverse a list in place — two pointers walking towards each other
Watch the ends swap and the pointers close in until they meet.
Watch it run
Step-through
Second largest — the branch everyone forgets
Watch a number that is not the biggest still change the answer.
Watch it run
Step-through
Total and average marks — the running total
Watch one box collect every mark before the division happens once at the end.
Watch it run
Step-through
Electricity Bill — charging in slabs
Watch 240 units fall past two slabs and get billed at three different rates.
Watch it run
Step-through
Even or Odd — checking every number in a list
Watch the program pick up one number at a time and decide which pile it belongs in.
Watch it run
Step-through
Marks to Grade — why the order of checks matters
Watch three different marks each take a different path through the same ladder of conditions.
Watch it run
Step-through
Largest of Three — keeping the best so far
Watch one box hold the winner and get replaced only when something bigger shows up.
Watch it run
Step-through
Leap Year — the rule with a trap in it
Watch 2024 pass the test and 1900 fail it, one condition at a time.
Watch it run
Step-through
Sum of Digits — peeling a number one digit at a time
Watch 472 shrink to 47, then 4, then nothing — while the total grows.
Watch it run
Step-through
Factorial — multiplying up to 120
Watch one box collect 1 × 2 × 3 × 4 × 5 as the counter climbs.
Watch it run
Step-through
Fibonacci — every number is the two before it
Watch the list grow, each new number made from the two already sitting behind it.
Watch it run
Step-through
FizzBuzz — why the order of the checks decides the answer
Watch 15 fall through to the right branch only because it is tested first.
Watch it run
Step-through
HCF by Euclid's method — the remainder trick
Watch 48 and 18 shrink to 6 and 0 in three quick rounds.
Watch it run
Step-through
Multiplication Table — the same two lines, four times
Watch i climb from 1 to 4 and the answer change with it.
Watch it run
Step-through
Is it prime? — and why break saves the rest of the work
Watch 21 get caught by its very first real divisor and the loop stop instantly.
Watch it run
Step-through
Reverse a Number — building it backwards
Watch 351 come apart from the right while 153 is built up from the left.
Watch it run
Step-through
Star triangle — the inner loop decides the shape
Watch the outer loop pick a row and the inner loop fill exactly as many stars as that row needs.
Watch it run
Step-through
Countdown — recursion that returns nothing at all
Watch the pile build, print Liftoff, then unwind with nothing to hand back.
Watch it run
Step-through
Recursion — a function that calls itself, and the pile it leaves behind
Watch three copies of the same function wait in a pile, each holding its own n.
Watch it run
Step-through
Recursive Fibonacci — watch it compute the same thing twice
Two calls per frame instead of one, and fib(1) gets worked out from scratch on two separate occasions.
Watch it run
Step-through
Power by recursion — and the base case that returns 1, not 0
Watch four frames stack up to compute 2³, and see why anything to the power 0 must be 1.
Watch it run
Step-through
Palindrome check — comparing from both ends inward
Watch two pointers close in on the middle, comparing as they go.
Watch it run
Step-through
Counting vowels — checking membership letter by letter
Watch each letter get held up against the list of vowels.
Watch it run
Step-through
Idiomatic Python in Action
Watch a list comprehension, enumerate(), and f-strings turn raw scores into a clean ranking — idiomatic Python in action.
Watch it run
Step-through
Counter & defaultdict in Action
Watch a Counter tally colours and a defaultdict group their positions as the loop runs.
Watch it run
Step-through
Talking to a Database
Connect, create, insert, commit, then fetch rows back — shown with stdlib sqlite3, the same pattern used for MySQL and PostgreSQL.
Watch it run
Step-through
Wrapping a Function with a Decorator
Watch how calling add actually runs the @log wrapper, which then calls the original.
Watch it run
Step-through
Building & Updating a Dictionary
Watch d change as keys are added, a value is updated, and pairs are iterated.
Watch it run
Step-through
Catching Errors with try / except / finally
Watch control jump from the failing line to except, while finally runs no matter what.
Watch it run
Step-through
Writing a File, Then Reading It Back
Watch notes.txt fill up as it is written, then flow back into a string when read.
Watch it run
Step-through
Adding Numbers with a Loop
Watch the total box grow as we add 1, 2, 3, 4, 5 one by one.
Watch it run
Step-through
Positional, Default, *args & Keyword Arguments
Watch one greet() handle three call styles as name, greeting and titles bind.
Watch it run
Step-through
Defining & Calling a Function
Watch control jump into square(), bind the parameter n, return a value, and come back.
Watch it run
Step-through
Choosing a Branch with if / elif / else
Watch the conditions get tested top-down until one wins — the rest are skipped.
Watch it run
Step-through
Reading Input & Showing Output
See how the program reads the lines we type in, one at a time, and prints answers back.
Watch it run
Step-through
Your First Python Program
Watch print() run line-by-line as output grows and a variable fills.
Watch it run
Step-through
Generators: Pause & Resume at yield
Watch the generator freeze at yield, hand back one value, then resume with n intact.
Watch it run
Step-through
Round-Tripping a Dict Through JSON
Watch a Python dict become a JSON string and turn back into a dict.
Watch it run
Step-through
Lambda with map() & filter()
Watch one lambda double every number while another keeps just the evens.
Watch it run
Step-through
List Comprehension with a Filter
Watch the comprehension unroll into a loop: each x is tested, and only odd ones get squared.
Watch it run
Step-through
Mutating a List In Place
Watch nums change after every append, insert, sort, and pop.
Watch it run
Step-through
break & continue in a Loop
Watch continue skip evens and break exit the loop once n passes 7.
Watch it run
Step-through
Importing Standard-Library Modules
Watch math, collections, and random each contribute to one deterministic run.
Watch it run
Step-through
Threads Sharing a Counter — Safely
Four workers add to one shared box; a lock makes them take turns and join() waits for all, so the total is always 4000.
Watch it run
Step-through
Star Patterns — Drawing with Loops
Watch a nested loop light up the board, one star at a time.
Watch it run
Step-through
Classes & Objects — Building a Dog
Watch __init__ bind self.name when the object is born, then call its method.
Watch it run
Step-through
Encapsulation: Protecting Private Data
Watch a private __balance change only through deposit, withdraw, and get_balance.
Watch it run
Step-through
Inheritance, Overriding & super()
Watch which speak() runs — the inherited base for Animal, the override for Dog reaching up via super().
Watch it run
Step-through
Operators on Two Numbers
Watch arithmetic, comparison, and logical operators each fire on a = 17 and b = 5.
Watch it run
Step-through
Searching & Replacing with Regex
Watch re.search, re.findall and re.sub hunt down phone numbers in one sentence.
Watch it run
Step-through
Common String Methods
Watch strip, lower, replace, split and find each return a fresh value.
Watch it run
Step-through
String Indexing, Slicing & Length
Watch one string answer many questions while it never changes itself.
Watch it run
Step-through
Tuples & Sets
A tuple stays fixed while a set drops duplicates and combines with union and intersection.
Watch it run
Step-through
Casting Between Types
Watch one value change type as int(), float(), and str() reshape it.
Watch it run
Step-through
Variables & Data Types
Watch Python infer a different type for each value you assign.
Watch it run
Step-through
Halving with a while Loop
Watch n shrink toward 1 and the loop exit the moment the condition fails.
Watch it run
Step-through
Composition — boxes with holes, not family trees
One Card, three wildly different fillings, zero inheritance: children is a hole, and UIs are holes filled with holes.
Watch it run
Architecture
Prop drilling vs Context — couriers vs the broadcast tower
Feel the user prop march through components that never use it, then watch one Provider make the chain disappear.
Watch it run
Step-through
Controlled inputs — one memory, or a form that lies
Run the drift: the box says "hi", your state says "" — then wire the keystrokes through state and watch them agree forever.
Watch it run
Step-through
Custom hooks — a recipe, never a shared pot
Build useToggle on the mini-useState shelf, call it twice, flip one — and prove the other never moves.
Watch it run
Step-through
The fetch race — when the wrong results win
Two requests, one screen: watch the stale response overwrite the fresh one, then fix it with a one-integer ticket check.
Watch it run
Step-through
The fetching state machine — and the fifth state everyone forgets
loading, error with a retry loop, success with data — and success with NOTHING, which deserves its own screen.
Watch it run
Architecture
JSX under the hood — HTML’s clothes, JavaScript’s body
Watch one JSX tag get compiled, become a plain object, and only then touch the real screen.
Watch it run
Step-through
key={index} — the bug that puts Ravi’s number under Priya’s name
Build React’s row-matching rule, run the famous list corruption for real, then fix it with one change.
Watch it run
Step-through
React.lazy & Suspense — the 80kb nobody asked for
A download ledger proves it: 20kb first paint, and the chart chunk ships only when someone actually opens Reports.
Watch it run
Step-through
React.memo vs === — equal content, different identity
Implement memo’s real comparison, then watch an inline object defeat it every single render.
Watch it run
Step-through
useState, built from scratch — where state REALLY lives
Your component is a function that forgets everything. Build React’s memory shelf in 15 runnable lines and watch a click survive a re-render.
Watch it run
Step-through
Props down, events up — the one-way street (and the 12-lesson recap)
The Button displays what it’s given and rings the bell it was handed — ownership never moves. Then the whole vertical, in one breath.
Watch it run
Step-through
useRef — the box that changes without redrawing
Mutate it twice, re-render zero times, and prove with === that every render gets the very same box.
Watch it run
Architecture
React Router — navigation without the white flash
Act 1: the old web tears the page down. Act 2: pushState, a path matcher, and a component swap — the server never hears about it.
Watch it run
Architecture
One click, one re-render — how React changes the screen
Follow a single click from setState to the one DOM node that actually changes.
Watch it run
Step-through
useEffect timing — built from scratch, painted first
Queue the effect, paint the screen, clean up the old world, then connect the new one — in 18 runnable lines.
Watch it run
Step-through
useMemo — the answer shelf (a work counter proves it)
Three renders: the plain filter pays 3 times, the memoized one pays once — and honestly re-pays when a dependency truly changes.
Watch it run
Step-through
Windowing — 10,000 rows, 12 DOM nodes
A node counter proves the whole technique: render only what the eye can see, and slide the window as the user scrolls.
Watch it run
Architecture
API Design — REST vs GraphQL
One profile screen: three REST round trips vs one GraphQL query
Watch it run
Architecture
Caching — the IPL Score Page
Cache-aside pattern: miss → fill → hit, TTL, and what breaks when the cache dies
Watch it run
Architecture
CDN — Content Close to the User
Why a Chennai student should never fetch an image from Mumbai twice
Watch it run
Architecture
CI/CD — the journey of one commit
Push → fresh build → the test wall → one sealed image → staging → a canary into production. Including the commit that never made it.
Watch it run
Architecture
Consistency & Quorums — One Balance, Three Copies
W+R > N overlap, read repair, and the CAP choice when the cable is cut
Watch it run
Hash ring
Consistent hashing — the ring that barely moves
Add a server: 2 of 8 keys re-home. Kill one: 1 moves. The naive modulo would have reshuffled nearly everything.
Watch it run
Architecture
The Consistent-Hashing Ring
Keys walk clockwise · a server joins (one arc moves) · a server dies (one arc slides) · vnodes + replication
Watch it run
Architecture
Blue-Green vs Canary — two ways to ship without burning users
One flips ALL traffic and can flip it back in seconds; the other lets 5% of users breathe the new version first.
Watch it run
Architecture
Design WhatsApp (Chat at Scale)
Persistent connections, a presence router, and durable offline delivery
Watch it run
Architecture
Design Video Streaming (Netflix / Hotstar)
Offline encoding, edge caching, adaptive bitrate, and the IPL concurrency spike
Watch it run
Architecture
Design a Payment Gateway (UPI / Razorpay)
Idempotency for retry-safety, record-before-act, async confirmation, and a reconciled ledger
Watch it run
Architecture
Design Ride-Sharing (Uber / Ola)
A hexagon geo-index over a GPS firehose, and ETA-based dispatch
Watch it run
Architecture
Design the Twitter Timeline
Fan-out-on-write for the many, fan-out-on-read for the celebrity few
Watch it run
Architecture
Design a URL Shortener (bit.ly)
Collision-free short codes, and a cache-first redirect path built for 100:1 reads
Watch it run
Architecture
DNS resolution — how a name finds a machine
Browser cache → resolver → root → TLD → authoritative — and on the second visit, silence: a cache hit.
Watch it run
Architecture
Docker vs Virtual Machines — who shares the kernel?
Two towers on one machine: every VM drags a full guest OS; every container packs only its libraries. Watch both get built.
Watch it run
Architecture
Instagram’s feed — the list that is built before you ask for it
Watch one post reach 300 followers, then watch the same design break on a film star and get fixed.
Watch it run
Architecture
What Is System Design?
The journey of one food-app order — and the HLD vs LLD zoom
Watch it run
Interactive simYOU CAN PLAY WITH THIS
Railway Seat Allocation — a berth is an interval, not a seat
Watch one berth get sold to two passengers at once, then watch a cancellation ripple down the waiting list.
Watch it run
Architecture
Kubernetes — the thermostat for containers
Declare "3 replicas". Watch a pod die at 2am and get replaced by arithmetic — then scale by editing a number.
Watch it run
Architecture
Serving an LLM — one request that is really five hundred
Watch a prompt get processed once in parallel, then produce answers one token at a time until the GPU runs out of memory.
Watch it run
Architecture
Load Balancing — The Traffic Police of the Internet
Round robin, least connections, health checks, failover — one afternoon in the life of three servers
Watch it run
Architecture
Message Queues — Do It Later, Reliably
One Zomato order: instant confirmation, async workers, and a queue that survives a crash
Watch it run
Architecture
Rate Limiting — The Token Bucket
Bursts allowed, floods rejected: watch tokens drain, hit 429, and refill
Watch it run
Architecture
Scalability — One Server to One Crore Users
Vertical vs horizontal, the stateless lesson, and read replicas — evolved live
Watch it run
Architecture
SQL vs NoSQL — One Read, Two Worlds
Normalized JOIN vs pre-stitched document: where the stitch lives, and what each world pays
Watch it run
Architecture
The TLS handshake — the secret behind the padlock
Prove who you’re talking to, agree on a secret in public, then switch to fast ciphers — all before one byte of your data moves.
Watch it run
Architecture
Inside the UPI rail — what happens in the two seconds after you scan
Follow ₹499 across four parties, then watch it get debited, fail to arrive, and come back by law.
Watch it run
Query walk
Aggregates — COUNT, MAX, AVG
Watch a whole column get squeezed into one answer row.
Watch it run
Query walk
INSERT, UPDATE, DELETE — Changing the Data
Watch three DML commands add, edit and remove rows, then read the finished table.
Watch it run
Query walk
IN — Is This Value One of These?
Watch IN check each city against the list — and meet its cousins EXISTS, ANY and ALL.
Watch it run
Query walk
GROUP BY & HAVING — Counting in Buckets
Watch rows fall into city buckets, get counted, and small buckets get filtered out.
Watch it run
Query walk
Interview Classic — Second Highest Salary
The most-asked SQL interview query: the biggest salary below the biggest salary.
Watch it run
Query walk
Your First SQL Query
A table is rows + columns — SELECT picks the columns, and every row comes back.
Watch it run
Query walk
JOIN — Gluing Two Tables Together
Match rows across tables on a shared key; unmatched rows drop out (INNER).
Watch it run
Query walk
Normalization — Store Each Fact Once
Split repeated course names into their own table, then JOIN to rebuild the full picture.
Watch it run
Query walk
ORDER BY & LIMIT — Top-N Queries
Sort the rows highest-first, then keep just the top 2. (DISTINCT gets a cameo.)
Watch it run
Query walk
SELECT & WHERE — Filtering Rows
Watch the query run clause-by-clause: filter rows, then pick columns, then sort.
Watch it run
Query walk
Self-Join — A Table Meets Itself
Two nicknames (e and m) for ONE employees table pair each person with their manager.
Watch it run
Query walk
UNION — Stacking Two Lists Into One
Two SELECT results piled top to bottom; duplicates kept only once.
Watch it run
Query walk
Subqueries — A Query Inside a Query
The inner query runs first and becomes one number; the outer query uses it to filter rows.
Watch it run
Query walk
Transactions — All or Nothing
Watch a money transfer inside BEGIN...COMMIT: debit one account, credit another, commit both together.
Watch it run
Query walk
Views — A Saved Query That Acts Like a Table
Define a view of the high scorers, then look through it like a window onto the real table.
Watch it run
Query walk
Window Functions — RANK() OVER
Rank every row without squashing any — and watch what a tie does to the numbers.
Watch it run
Browse the full coding syllabus