Skip to content
Katabench
Try free

Online C# practice, graded beyond correct

C# coding challenges that grade what production cares about

Write C# in the browser and get specific feedback on more than output. Katabench measures time and memory, captures database plans, checks code structure, and runs adversarial tests across 386 focused exercises.

No signup required for your first puzzle. Nothing to install.

Solution.cs Trapping Rain Water · Hard
1 public int Trap(int[] height)
2 {
3 int l = 0, r = height.Length - 1, lMax = 0, rMax = 0, water = 0;
4 while (l < r)
5 {
6 if (height[l] < height[r])
7 water += (lMax = Math.Max(lMax, height[l])) - height[l++];
8 else
9 water += (rMax = Math.Max(rMax, height[r])) - height[r--];
10 }
11 return water;
12 }
Submission graded 3 / 3 tests passed
Example 1
Passed 0.18 ms
Example 2
Passed 0.21 ms
Large input (n = 1,000,000), must be O(n) hidden
Passed 6.84 ms
time budget 3% of 250 ms
memory 0 B allocated

Correct, fast, and allocation-aware: the result shows all three on the same submission.

Advanced C# exercises

Practice the parts of engineering that simple kata miss

The catalog starts with algorithms and keeps going into the work that fills an actual .NET codebase. Pick one discipline for focused reps or follow a guided learning path through a deliberate sequence.

125 challenges

Algorithms and performance

Solve familiar algorithm problems, then face inputs large enough to expose the wrong complexity and allocation budgets that punish needless copying.

130 challenges

Database and EF Core

Write LINQ and SQL against real PostgreSQL. See every generated query, inspect the execution plan, and learn when the database did the wrong work.

54 challenges

Refactoring

Clean up working C# while behavioral tests stay green. The grader measures complexity, nesting, method length, and duplication from your source.

19 challenges

Software architecture

Work across multiple files and make dependencies point the right way. Architecture rules turn design boundaries into executable feedback.

20 challenges

Secure coding

Repair vulnerable code without breaking its behavior. Functional tests and adversarial payloads both have to pass before the solution is accepted.

24 challenges

Test writing

Write tests that catch planted bugs. A suite passes only when it stays green on correct code and turns enough faulty implementations red.

14 challenges

Design principles

Practice immutability, invariants, dependency inversion, and behavioral patterns with executable structural checks on the result.

Want an ordered data-access progression? Start with the LINQ exercises. For a broader sequence across disciplines, follow a guided C# learning path.

The feedback loop

Every submission answers a better question

Not only "did it pass?" but "what did the code cost, and would this solution survive the constraints that expose weak engineering?"

01

Correctness

Visible examples help you iterate. Hidden tests cover edge cases and larger inputs without handing you the answer.

02

Performance and memory

Every test reports server-measured time and allocated bytes. Some challenges enforce hard budgets for both.

03

Production quality

Specialized tracks grade query plans, code structure, dependency rules, security payloads, or the strength of the tests you wrote.

Read how grading works or see how each submission runs inside an isolated server-side sandbox.

Who this is for

C# practice for developers past the syntax stage

You want production instincts

You know how to make code compile. Now you want to recognize an accidental O(n²), see the SQL behind LINQ, refactor without changing behavior, and close a security hole for the right reason.

You want deliberate reps

Each exercise isolates one skill, returns immediate evidence, and gives you another attempt. Use open practice for variety or Learning Paths when you want the next challenge chosen for you.

C# coding challenge FAQ

Before you start

Can I solve the C# coding challenges online?

Yes. The editor, compiler, tests, and results all run from your browser. Your code executes in a disposable server-side sandbox, so there is no SDK or local setup required.

Are these C# exercises for beginners or experienced developers?

Katabench is built primarily for working developers who already know C# syntax and want deeper practice in performance, data access, refactoring, architecture, testing, and security. Challenges range from Easy to Hard.

Are the C# challenges free?

The Free plan includes the algorithm catalog, time and memory feedback, a guided Tour, and daily graded submissions. Pro unlocks the specialized tracks and full hidden suites.

What makes these different from interview coding problems?

Correct output is only the starting point. Depending on the track, a solution may also need to meet a time or allocation budget, use the intended database plan, satisfy architecture rules, or block real attack payloads.

Find out what your green checkmark missed

Open a C# challenge, run the samples, then submit against the production-grade checks. Your first puzzle needs no account.

Try a C# challenge free

Get new puzzles and .NET tips in your inbox

A short note when fresh kata land, plus the C# and performance tricks behind the grading. No spam, unsubscribe anytime.