AlgoMaster Logo

Concurrency Practice

Practice writing actual multi-threaded code for common concurrency challenges in interviews and real-world scenarios.

How it Works
1medium
2medium
3medium
4medium
5medium
6medium
7medium
8medium
9medium
10medium
11medium
12hard
13easy
14medium
15medium
16medium
17medium
18hard
19medium
20medium
21hard
22easy
23medium
24medium
25medium
26medium
27medium
28hard
29hard
30hard
31hard
32hard
33medium
34medium
35medium
36medium
37medium
38medium
39medium
40medium
41hard
42medium
43medium
44medium
45medium
46medium
47medium
48hard
49hard
50hard

How it Works

Each exercise gives you a class that the judge calls from several threads at once. You write the synchronization, and the judge runs your implementation against a set of concurrent scenarios and compares the result with the expected output.

Multi-threaded execution

The judge calls your class from several threads and checks what comes back. Some exercises hand you the threads and ask you to protect shared state; others ask you to create and coordinate the workers yourself.

Scenario-based verdicts

Each scenario reports a concrete result: the order the callbacks ran in, a final count, the set of nodes visited. Missing synchronization usually surfaces as a wrong value rather than an exception, and often on only some runs.

Optional AI code review

Evaluate sends your current code to a reviewer that reports on correctness, edge cases, efficiency and code quality, with a time and space complexity estimate. It executes nothing and does not affect your verdict.

What each exercise involves

  1. 1

    Read the problem

    The statement gives the class to implement, the guarantee it has to hold under concurrent calls, and worked examples with their expected output. Concurrency, collection and callback APIs are preloaded, so no imports are needed.

  2. 2

    Implement

    Write the class in Java, Python, C++, Go or C#. Drafts are kept per language as you work, and your last submitted code for each language is saved to your account.

  3. 3

    Run

    Executes only the example cases listed in the Test cases tab and shows the expected and actual output for each. Nothing hidden runs, so a passing run is a starting point rather than a verdict.

  4. 4

    Submit

    Executes the full scenario set, including the cases that are not shown, and records the result in the Submissions tab. Any earlier submission can be loaded back into the editor.

Worked examples and their expected output appear in the problem panel before you write anything, so a failing run can be read against a known-good result.

Frequently asked questions

How is thread safety actually checked?

Each scenario drives your class from several threads and compares what it produces against the expected output. Some scenarios also check ordering, for example that a task waiting on a held lock does not enter until the lock is released. A correct implementation returns the same result every run; an unsynchronized one usually returns a wrong one, sometimes only occasionally.

My code passed once and failed the next time. Is the judge flaky?

That pattern is the ordinary symptom of a race condition: the interleaving that breaks the code only occurs on some runs. Treat an intermittent pass as a failure and look for state that is read or written outside a lock. Resubmitting until it passes leaves the bug in place.

How is this different from the low-level design practice?

Low-level design judges a class against a fixed sequence of calls and reviews the design it implies. These exercises run concurrent scenarios and compare the output, with no design score, because correctness here means holding an invariant under interleaving rather than shaping a good API.

Which languages are supported?

Java, Python, C++, Go and C#. Every exercise ships a starter class and a reference solution in all five, and the editor language picker lists exactly those.

Is my code saved?

Yes. Drafts are stored in your browser per exercise and per language, and your last submitted code for each language is saved to your account. The Submissions tab keeps every attempt, and selecting one loads its code back into the editor.

What are the usage limits?

An account is required to run, submit or evaluate. Free accounts get 50 runs, 30 submissions and 30 evaluations a day. AlgoMaster premium members get unlimited.