Skip to content
Katabench
Try free

The editor & runtime

6 min read

The editor is where you'll spend your time, so it's worth two minutes to learn what it expects and what it gives you back.

What you write

Every puzzle hands you a starter file with a single public class and one method to implement:

C#
using System;

public class Solution
{
    // TODO: return the sum of two binary strings, as a binary string.
    public string AddBinary(string a, string b)
    {
        throw new NotImplementedException();
    }
}

The grader calls that method by name, so a few rules follow from it:

  • Don't rename Solution or the entry method, and don't change its signature. They're the contract the grader binds to. Everything else inside the class is yours: add helper methods, fields, nested types, whatever the solution needs.
  • There is no Main. Submissions compile to a library, not a program, so top-level statements won't run. Put your logic in the method.
  • Add the using directives you need at the top of the file. The full .NET base class library is referenced. Collections, LINQ, Span<T>, System.Text, System.Numerics, regular expressions, and the rest all resolve.

The C# you can use

Submissions use C# 12 in Release mode, so the modern language is at your disposal: pattern matching, records, switch expressions, collection expressions, spans, and so on. Two deliberate limits:

  • unsafe code is disabled at the compiler level. It's a sharp edge you don't need for these puzzles, and turning it off is one more guard around the sandbox.
  • No external NuGet packages. You get the base class library and nothing else, so a solution is always your algorithm, not a one-line call into someone else's. The Database / EF Core track is the exception: those puzzles also reference EF Core so you can write LINQ over the model.

Compilation has its own time limit. If you hit it, the result tells you so. Ordinary puzzle code should compile comfortably within it.

Multiple files

Most puzzles are a single file. Architecture katas and some other project-shaped exercises are not: you get a small multi-file project in tabs and work across it. The selected tab is the file shown in the editor, but the whole project compiles together.

The file tabs let you add a new file (the .cs extension is added for you) or remove a file; the last remaining file cannot be removed. Each file has its own saved buffer. Reset restores the complete starter file set, including files you changed or removed, and discards files you added. Right after you remove a file or Reset, Undo in the notice over the editor brings your files back. The notice closes when you type, switch puzzles or reload, and in a multi-file kata it is the only way back, so undo before you edit.

Run, Submit, and the keyboard

Two buttons have two very different jobs. They are covered in full in Getting started:

Action Button Shortcut What it does
Run ▶ Run Ctrl/Cmd + Enter Executes the visible sample cases and any custom input you typed. It does not use a submission.
Submit Submit Ctrl/Cmd + Shift + Enter Grades you against the full hidden suite. Counts toward your daily quota on the Free plan.

Run is for iterating; Submit is for the verdict. The rhythm that works is: Run until the samples pass, add a custom edge case, reason about complexity, and then Submit. Every other shortcut, including the editor's built-in commands, is listed in Keyboard shortcuts & workspace tips.

Custom input

The Output tab has a Try your own input section below the results. Enter the method arguments as a JSON-shaped array, then press Enter or Run with input. Custom input shows the return value and console output without a pass/fail verdict because you did not provide an expected answer.

Custom input is remembered per puzzle in the current browser. It is not included in Submit and does not become part of the hidden suite. Database and test-writing puzzles do not offer custom input: database inputs are the seeded fixtures described in the schema panel, and a test-writing Run executes your own tests.

Output and errors

When you Run, anything you write with Console.WriteLine is captured and shown beside the return value. This is handy for a quick trace while you debug. Compile errors appear inline in the editor as red underlines, with the same diagnostics the compiler produced, so you can fix them without leaving the keyboard.

The result area separates Output from Tests. Output is where you inspect inputs, return values, console output, and visible differences. Tests is where you inspect the full graded evidence, hidden-test verdicts after Submit, track-specific rules, and failing-only filter.

Your work is saved

Your in-progress code is kept per puzzle, automatically, as you type. Every keystroke updates a buffer in the current browser, so closing the tab in the middle of a thought costs nothing on that browser. Clearing site data removes those local buffers.

When you are signed in, the whole document is also saved to your account as a draft shortly after you stop typing, and restored when you open the puzzle on any device. Opening a puzzle picks the most useful starting point in this order: your saved draft, then your accepted solution if the puzzle is already solved, then the local buffer, then the starter. Work you did as a guest moves into your account the first time you sign in on that browser.

The results bar under the editor (the More code actions menu on a phone) says where your code is right now: Saved in this browser for a guest, Saving… and then Saved for a signed-in draft, and Not synced if the account save failed. Not synced edits are only in this browser: keep the tab open, and your next edit tries the save again. If you reload or open another puzzle first and your account already has a draft of this puzzle, that saved draft opens instead and the unsynced edits are replaced. When a puzzle opens on saved work, a short note says where it came from, such as Draft restored · edited 2 h ago, or says so when your account draft replaced unsynced edits.

Drafts are private to your account. If you switch accounts in the same browser, the workspace blanks and reloads the new account's draft; if that load fails, use Retry private workspace.

When you want a clean slate, Reset restores the original starter. When you are stuck, progressive hints preserve more of the struggle; Reveal solution loads a correct reference you can study. Reset afterwards and reproduce the approach from memory. Revealing does not mark the puzzle solved. Both overwrite your saved code, so take them back right away: select Undo (after Reset) or Restore my attempt (after Reveal) in the notice over the editor. The notice closes when you type, switch puzzles or reload. In a single-file puzzle Ctrl/Cmd + Z in the editor still brings your attempt back after you type, until you switch puzzles or reload; in a multi-file kata the notice is the only way back.

See How grading works for what happens after you hit Submit.