CODE THE HERO

Write real code. Watch it come alive.

Code the Hero turns data structures and algorithms into a pixel adventure. You write JavaScript, press Run, and a hero walks, lifts, swaps, stacks and searches — exactly as your code says, one highlighted line at a time.

No sign-up. Works on phones and laptops. Your progress saves in your browser.

The Code the Hero hero standing below a row of numbered crates, the heaviest one glowing gold

How it works

Every level is one small coding task set in a pixel world — the kind of problem you meet in placement tests and interviews.

1

Write code

Every level starts with partly written code. Tap command chips to type fast on a phone.

2

Press Run

The hero acts out each command while the running line lights up, so you see how the algorithm works.

3

Earn stars

Your code is also tested on hidden inputs. Efficient solutions — the right Big-O — earn three stars.

// Level 1.1: find the heaviest crate
let best = crates.get(0);
for (let i = 1; i < crates.length; i++) {
  let w = crates.get(i);   // hero lifts crate i
  if (w > best) best = w;
}
submit(best);   // ★★★ one lift per crate

Mistakes become enemies

  • Off-By-One Impappears when you reach past the end of a row.
  • Infinite Looperspins when a loop never stops.
  • Null Wraithhaunts you for popping an empty stack.
  • Lag Goblinsswarm code that repeats work.

Each one comes with a plain-language hint on how to fix your code.

10 worlds · 70 levels

The core interview syllabus in learning order. Each world ends with a boss.

FREE

1. Array Plains

Scanning, reversing, prefix sums, rotation, Kadane

FREE

2. Twin Rivers

Two pointers and sliding windows

FREE

3. Hash Harbor

Hash maps, two sum, anagrams, prefix sums

PREMIUM

4. Binary Peaks

Binary search and searching on the answer

PREMIUM

5. Sorting Factory

Selection, insertion, merge and quick sort

PREMIUM

6. Mirror Caves

Recursion, backtracking, N-Queens

PREMIUM

7. Chain Railway

Linked lists and Floyd's cycle detection

PREMIUM

8. Stack Tower

Stacks, queues, monotonic stacks, deques

PREMIUM

9. Tree Forest

Traversals, binary search trees, heaps

PREMIUM

10. Graph Kingdom

DFS, BFS, topological sort, union-find, Dijkstra

Made for

Students

Preparing for campus placements and coding rounds, on a budget phone or a laptop.

Developers

Switching jobs and brushing up on patterns and Big-O in short sessions.

Beginners

Know a little code and want DSA to finally click, with starter code in every level.

Free to start

FREE

Worlds 1–3 · 21 levels

  • Arrays, two pointers, sliding windows and hashing
  • Streaks, badges and hero outfits
  • No ads, ever

Play now

PREMIUM · COMING SOON

All 10 worlds · 70 levels

  • Binary search, sorting, recursion, linked lists, stacks, trees and graphs
  • Daily challenge leaderboard
  • Solution replays and exclusive outfits

Planned from ₹149 a month, ₹999 a year or ₹1,999 once.

Questions

Do I need to install anything?

No. The game runs in your browser on phones, tablets and laptops. On a phone you can also add it to your home screen, and it keeps working offline.

Which programming language?

JavaScript. Python is planned for a later update.

Is my code really run?

Yes. Your code runs in a safe sandbox inside your browser. Every command it calls is recorded and acted out by the hero, then your code is checked on hidden inputs so it has to truly work.

Where is my progress saved?

In this browser, on this device. Accounts with cloud save across devices are coming soon.

Is there an Android app?

An Android app is on the way. The web version is the same game.

Ready, hero?

King Brute broke the world with slow, clumsy code. Only you can fix it.

▶ Start Level 1