Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

154 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Coding Challenges

57 self-contained algorithm and systems challenges. Most use file-based cases, an optimized reference, a deliberately naive benchmark control, and stubs in Python, Go, Rust, and C. A few exercises use an API test suite or a systems stress test instead. Run make in a language directory to format, build, lint, and test.


Quick start

# pick a challenge, pick a language
make -C 05-medium-price-streak/rust       # fmt → build → lint → test
make -C 05-medium-price-streak/go bench   # check and time your solution on large inputs

From the repo root, verify the whole bench at once:

make test        # I/O and API golden suites; I/O rotten small suites pass
make golden      # I/O and API golden tests pass; I/O benchmarks stay fast
make rotten      # I/O rotten controls pass small cases; every large case times out
make sys         # systems golden C stress tests pass
make sys-rotten  # systems controls pass sanity and fail controlled stress

I/O solver directories share these targets:

target does
make fmt → build → lint → test (default)
make build compile or syntax-check
make fmt format in place
make lint run static analysis
make check format, then lint
make test correctness — small cases only, fast
make bench correctness + speed — compare every large result, then report time
make help list all targets

API, systems, and quiz challenges use targets suited to their test style. Their challenge README and make help list the available commands.


I/O challenge structure

NN-level-slug/
  README.md      ← the problem only: task, constraints, I/O, examples
  HINTS.md       ← the approach/technique — spoilers, open only when stuck
  cases/         ← NN.in / NN.out  (I/O challenges)
  golden/        ← optimized reference; always passes make test
  rotten/        ← deliberately naive benchmark control
  python/        ← stub: implement solve() in main.py
  go/            ← stub: implement solve() in main.go
  rust/          ← stub: implement solve() in src/main.rs
  c/             ← stub: implement solve() in solution.c

The C directory ships a finished scaffold — json.h, harness.h, main.c, and test.c are shared and identical everywhere. Only solution.c holds the stub: input_parse and answer_print are written for you, solve() is not.

The README.md, challenge title, directory slug, and catalog never narrow the solution search. All guidance, including rejected approaches and complexity comparisons, lives in HINTS.md.

Four challenge types:

  • io — reads JSON from stdin and writes one line in the documented format
  • api — implements functions checked directly by a language test suite
  • sys — exposes a systems API; the test is a stress test rather than files
  • quiz — asks for predictions about standalone programs, then checks them

I/O challenge input is always JSON ({"n":4,"edges":[[0,1]],"loads":[10,null]}), so parsing is real work rather than splitting whitespace.


Challenges

Difficulty is based on prerequisite depth, correctness edge cases, implementation burden, and the constraints enforced by make bench.

# Name Level Lang
01 Maximum Subarray easy py go rs c
02 Modular Power easy py go rs c
03 Max Drawdown easy py go rs c
04 Vertex Load Assignment medium py go rs c
05 Price Streak medium py go rs c
06 Edit Distance medium py go rs c
07 Coin Change medium py go rs c
08 Interval Scheduling medium py go rs c
09 Count Inversions medium py go rs c
10 Route Costs medium py go rs c
11 Friend Groups medium py go rs c
12 Textbook Split medium py go rs c
13 Sliding Window Maximum medium py go rs c
14 Count Primes medium py go rs c
15 Huge Fibonacci medium py go rs c
16 String Search medium py go rs c
17 0/1 Knapsack medium py go rs c
18 Task Ordering medium py go rs c
19 Cheapest Road Network medium py go rs c
20 Longest Common Subsequence medium py go rs c
21 Constraint Puzzles medium py go
22 Unbounded Sequences medium py go
23 Search Suggestions medium py go rs c
24 Cache Eviction medium py go rs c
25 Running Median medium py go rs c
26 Dynamic Prefix Sums medium py go rs c
27 Weighted Job Scheduling medium py go rs c
28 News Feed Merge medium py go rs c
29 Multi-Producer Queue hard go rs c
30 Consistent Tick Snapshot hard go rs c
31 Concurrent Owner/Thief Deque hard rs c
32 Two-Thread Buffer hard go rs c
33 Lock-Free Stack Reclamation hard rs c
34 Reusable Spin Barrier hard go rs c
35 Dynamic Range Sums hard py go rs c
36 Matrix Chain Multiplication hard py go rs c
37 Prime Pair Sets hard py go rs c
38 Distinct Substrings hard py go rs c
39 Max Flow hard py go rs c
40 Go Concurrency Quizzes hard go
41 Ordered Set Queries hard py go rs c
42 Fragmented String Queries hard py go rs c
43 Order Book hard py go rs c
44 Affine Alignment Score hard py go rs c
45 K-mer Assembly hard py go rs c
46 CRISPR Off-Targets hard py go rs c
47 RNA Max Pairs hard py go rs c
48 Shortest Superstring hard py go rs c
49 Gene Region Decoder hard py go rs c
50 Tree Sequence Likelihood hard py go rs c
51 Deadline Scheduler hard py go rs c
52 Service Pairing hard py go rs c
53 Circular Genome Distance hard py go rs c
54 Spectrum Peptide Recovery hard py go rs c
55 Changing Network Queries hard py go rs c
56 Orthogonal Segment Crossings hard py go rs c
57 Causal Event Replay hard py go rs c

Adding a challenge

  1. Copy template/ to the next numbered directory.
  2. Write the pure specification in README.md. Put all solution guidance and solution-bearing sources in HINTS.md.
  3. Add the optimized implementation in golden/ and the short, correct, naive control in rotten/. Keep every solver solve body stubbed.
  4. Add at least eight small fixture pairs and at least two large pairs. Each large input must independently make the rotten implementation exceed its timeout.
  5. Run the root make golden and make rotten contract checks.
  6. Add the challenge to the catalog above.

Sources

Each challenge keeps solution-neutral attribution in its README.md. Solution-bearing references live in HINTS.md. Upstream problem sets and reference works are credited in NOTICE.

Development assisted by Claude Code (Anthropic).


License

GNU General Public License v3.0 — LICENSE.

About

some coding challenges you should be able to solve

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages