A new way to learn data structures & algorithms

Don't just solve it.
Feel how it works.

LeetGame turns interview problems into tactile puzzles—so you learn to think in states, steps, and constraints before you write a line of code.

Challenge #122 · Stock Trading
STEP 1 / 03
EasyArray · Greedy

The interview problem

Best Time to Buy and Sell Stock

You are given six daily prices. Choose one day to buy and a later day to sell. Return the maximum profit. If no profitable trade exists, return zero.

EXAMPLE 01
Inputprices = [7, 1, 5, 3, 6, 4]
Output5
D1$7
D2$1
D3$5
D4$3
D5$6
D6$4

Buy on day 2 at $1. Sell on day 5 at $6. Profit: $5.

A playable concept based on the working Flutter prototype. No code editor. No syntax anxiety.

The learning gap

Humans see the answer.
Computers earn it.

On a small array, your eyes can spot the maximum instantly. A computer cannot. It must read, compare, remember, and move—one operation at a time.

LeetGame removes the visual shortcuts and makes algorithmic constraints physical. The abstract becomes a sequence you can feel.

01

The interface removes shortcuts.

No omniscient view. You work with the same local information and limited operations an algorithm has.

02

Every action changes state.

Reads, writes, shifts, pointer moves, and stack operations become visible, deliberate decisions.

03

Efficiency becomes a score.

Your result earns the win. Your move count reveals whether you found the algorithmic pattern.

Inside the playground

Algorithms become objects.

Each challenge translates an invisible machine operation into a focused, constraint-driven interaction.

Greedy122

Trade one day at a time.

See only the price a computer can see. Buy, sell, or wait—and discover why every uphill matters.

Math007

Reverse without seeing digits.

Extract, remove, and rebuild. Turn modulo and integer division into movements you can remember.

PointersNEXT

Move like memory moves.

Traverse links, preserve references, and feel the exact order that keeps a data structure alive.

The visionROADMAP

From arrays to graphs.

A growing playground for sliding windows, recursion, trees, heaps, dynamic programming, and beyond.

operations per digit in Reverse Integer

1

machine-visible decision at a time

patterns waiting to become playable

Built for the full interview journey

Start with motion. End with mastery.

The prototype begins with greedy decisions and digit mechanics. The roadmap expands into arrays, pointers, sliding windows, recursion, trees, heaps, graphs, and dynamic programming.

Follow the build on GitHub
Foundations
ArraysPointers
PatternsRecursion
Mastery

Questions, answered

Before you press play.

Is LeetGame another code editor?

No. It is the layer before code: an interactive environment where you perform the algorithm's operations and build the right mental model first.

Who is it designed for?

Students and early-career developers preparing for technical interviews, especially anyone who understands a solution only after tracing it by hand.

Is there a working prototype?

Yes. The Flutter prototype currently includes Stock Trading II and Reverse Integer, with persistent XP, levels, and star scores.

What comes next?

More challenge engines, accurate complexity-based scoring, structured learning paths, spaced repetition, and a stronger bridge from physical actions to production code.

LeetGame is just getting started

Think less like a spectator.

Think more like a machine.

Explore the project