Skip to content
Katabench
Try free

The proving ground for .NET developers

Become a measurably better engineer

Graded C# and .NET katas: algorithms held to time and allocation budgets, EF Core and SQL queries measured on a real database down to the execution plan, plus architecture, refactoring, secure coding, and test writing.

Solve Two Sum in the real editor. Create an account only after you pass.

Choose your first exercise

All three are free. No account or setup needed.

Each exercise opens a longer Pro learning path. See the paths →

Solution.cs Trapping Rain Water · Hard
public long Trap(int[] height)
{
int l = 0, r = height.Length - 1, lMax = 0, rMax = 0;
long water = 0;
while (l < r)
{
if (height[l] < height[r])
water += (lMax = Math.Max(lMax, height[l])) - height[l++];
else
water += (rMax = Math.Max(rMax, height[r])) - height[r--];
}
return water;
}
Submission graded 5 / 5 tests passed
✓ Classic example
Passed 180 µs
✓ Deep basin
Passed 210 µs

✓ 2 more visible tests passed

✓ Large input · O(n) hidden
Passed 640 µs
time budget <1% of 200 ms
memory 48 B allocated

Code submissions are measured like this: per test, on the server.

graded puzzles, Easy to Hard
504
code disciplines plus the System Design beta
7 + 1
algorithm puzzles on the Free plan
114

Two ways to practice

Puzzles for focused reps. Labs for guided system practice.

Train one engineering skill at a time, or follow a structured course through executable projects. Both make you write the code and prove the result.

Puzzles

C# coding challenges for focused practice

Solve a bounded problem, submit against hidden tests, and get production-grade feedback on correctness, performance, allocations, database plans, structure, or security.

Explore C# coding challenges →

Katabench Labs

Build a transactional outbox

Preview the 4-lesson transactional outbox lab. See how a small .NET service loses order events and the changes that fix it, while its live workspace completes private-beta validation.

Preview the Outbox lab →

The disciplines

Seven disciplines, one bar: production quality

Algorithm drills are the smallest part of the job. Each code discipline trains a different fundamental of the craft. System Design adds a visual eighth practice surface.

114 puzzles

Algorithms

Classic problems where correct is only halfway: hidden 200,000-element gates time out the O(n²) pass, and allocation budgets (measured by the GC, not estimated) fail the copy-happy one.

206 puzzles

Database & EF Core

LINQ against a real PostgreSQL database. The grader captures the execution plan the engine actually chose, and grades it. Kill the N+1, earn the index scan.

51 puzzles

Refactoring

Inherit working-but-awful code (including the famous Gilded Rose) and clean it up. Roslyn measures complexity, nesting, duplication, and method length while every test stays green.

33 puzzles

Architecture

Multi-file katas graded on design itself: dependency direction, layer isolation, extracted interfaces, sealed types. A wrong dependency fails the same way a failing test does.

34 puzzles

Secure Coding

Fix vulnerable-but-working code against real attack payloads: path traversal, SQL injection, SSRF, open redirect. Block the exploit without breaking the feature.

28 puzzles

Design Principles

Small katas on the principles behind the patterns: make a value object truly immutable, seal an aggregate's invariants, invert a dependency. Graded on structure, not just behavior.

38 puzzles

Test Writing

You write the tests. Your suite runs against a correct implementation and a set of planted-bug mutants, and passes only when it catches enough of them. Coverage that has to actually detect bugs.

504

graded puzzles and counting

Every one with a gate that green checkmarks can't fake, and new puzzles ship with every release.

Each card opens the focused practice catalog for that discipline. Prefer an ordered curriculum? Follow the C# and .NET learning paths.

Beta System Design Studio

Do not just draw the architecture.
Make the design earn a pass.

Build a provider-neutral topology on a rich canvas. Deterministic rules check its paths, service boundaries, redundancy, messaging, storage, security, and observability, then a real lesson explains the tradeoffs after you solve it.

progressive challenges
71
standard components
28
foundations to capstone
Easy to Hard
Explore System Design
The Katabench System Design Studio showing an upload pipeline with a virtual network, object storage, messaging, secrets, and observability.

Exhibit A

Your query plan is part of the grade

Submit LINQ and we run it on a real PostgreSQL instance seeded with tens of thousands of rows, capture the execution plan the engine actually chose, and grade the plan itself. Getting the right rows the wrong way is a visible, gradeable mistake here. Start with the ordered LINQ exercises, or explore the full set of EF Core exercises built around that feedback loop.

🧭 Your query plan, captured from the database, graded

The obvious filter

.Where(t => t.TappedAt.AddHours(offset).Year == year && t.TappedAt.AddHours(offset).Month == month)

Sort (by id)

└ Seq Scan on taps

60,000 rows read · ⚠ full table read

  • ✗ No full-table scan on taps
  • ✗ Uses ix_taps_tapped_at
  • ✓ One round-trip

✗ 1 / 3 plan rules hold

The sargable rewrite

.Where(t => t.TappedAt >= start && t.TappedAt < end)

Sort (by id)

└ Index Scan on taps using ix_taps_tapped_at

100 rows read · ✓

  • ✓ No full-table scan on taps
  • ✓ Uses ix_taps_tapped_at
  • ✓ One round-trip

✓ 3 / 3 plan rules hold

Same rows returned. Same green tests. Only one earns the index scan, and the grade.

Straight from the engine

The plan comes from the database that just ran your query on realistic data, not a simulation, not a guess.

Readable verdicts

Full-table reads called out in red, index usage in green, row estimates on every node, even on hidden tests.

Rules, not vibes

No full-table scan, must use the index, one round-trip: pass/fail rules evaluated against the captured plan.

How it works

1

Pick a puzzle

Seven code tracks plus the System Design beta, Easy to Hard. Each puzzle states the goal, the constraints, and the bar you have to clear: a time budget, an allocation ceiling, a plan rule, a design rule.

2

Run or Check

Run visible cases in the code editor, or build a topology and Check its paths, boundaries, redundancy, and dangerous bypasses. Iterate before the final grade.

3

Submit for grading

Your solution faces the discipline-specific grader: hidden tests and metrics for code, or deterministic semantic rules for a system topology.

Code runs in a hardened disposable sandbox. System Design topologies are validated and graded as bounded data, without executing learner code. See exactly what happens →

Guided Learning Paths

Stop wondering what to practice next

Follow a deliberate sequence across algorithms, data access, refactoring, architecture, and secure coding. The path supplies the curriculum. Katabench still makes you prove every step against real correctness, performance, query-plan, and structure gates.

Database and EF Core

High-Performance Data Access

63%
✓Shape the query on the server
3Write the SQL directlyContinue →
Finish reward Badge · 250 XP · 25 gems

The grader

Built for deliberate practice

One platform, discipline-specific evidence. Every verdict is evaluated where it cannot be faked.

Allocations, measured by the GC

Every test reports server-measured elapsed time against its budget plus managed-heap allocations, median of repeated runs, so a GC pause can't flip your verdict. Some puzzles set hard budgets: a 100 KB input under a 16 KB allocation ceiling forces the in-place solution.

Real database, real plans

Database puzzles run on a real PostgreSQL instance seeded for your submission. Expand any test to see every SQL statement your LINQ produced, what it cost, and the plan the engine chose.

Structure, measured by Roslyn

Refactoring katas parse your source and measure it: cyclomatic complexity, nesting depth, method length, duplicate blocks. The tests stay green, the mess has to go.

Architecture rules as tests

Dependency direction, layering, abstractions, and sealed types are verified on every submission. A wrong dependency fails the grade, not a code review three weeks later.

Graded against real attacks

Secure-coding puzzles run a second, adversarial suite: traversal strings, SQL-injection payloads, forged log lines, SSRF probes at the cloud metadata endpoint. Exploits blocked and behavior preserved. Both, or no pass.

Stuck? Reveal the solution

Give up gracefully: load a correct, optimal reference solution into the editor, study it, then reset and try to beat it from memory.

Not another passive course

Learning Paths give you the route. The proving ground makes you apply it, defend it, and earn the progress that shows it stuck.

You watch

Video courses

Great for absorbing new concepts, but nothing measures whether you can actually apply them under constraints.

You pass

Interview grinders

Binary right/wrong on correctness, optimized for getting hired. An O(n²) pass teaches the wrong lesson.

You get sharper

The proving ground

Graded on the qualities production actually judges, so what you practice here transfers to the job. Progress reflects proof, not time spent watching.

Learn concepts anywhere. Prove the skill here. Built by a working .NET engineer and educator, for the engineers who want their practice to count.

Simple pricing

Start free, no credit card. Go Pro for the Database, Refactoring, Architecture, and Secure Coding tracks, every guided path, and no daily cap.

Free

The full algorithm catalog, graded. No credit card.

Freeforever

Pro

Most popular

The full proving ground: every premium track, every gate, no daily cap.

$19/mo

Pro+

For people training hard: more parallel runs, first access to new tracks, and direct support.

$39/mo

Compare plans in detail →

Try the grader on a real kata

Pick a puzzle, press Run, and see how fast your code really is. Then make it faster.

Try it free, no signup