Skip to content

Latest commit

 

History

History
269 lines (204 loc) · 23.7 KB

content.md

File metadata and controls

269 lines (204 loc) · 23.7 KB

Spec: Content

What the catalog contains: tracks, the DSA pattern taxonomy with Phase targets, the format of rubric-checked problems, and the copyright policy. How to write a problem is in authoring.

Tracks

DSA is roughly a third of a senior or staff loop, so the catalog covers the other rounds too.

Every problem also has three labels that are independent of the track: domains, job_roles and scope. The first security and AI/LLM problems use them: token-claim-validator, refresh-token-rotation, authorization-policy-engine, calibration-metrics, token-cost-reconciler, bm25-hybrid-ranker, stream-reassembler in the catalog, in Python and TypeScript (ADR 0020).

Track id Name Autograded Location Format Target
dsa Data structures and algorithms yes problems/ function or design 185 (Phases 1 and 3)
practical Practical multi-level yes, level by level problems/ progressive, function or design, or project (a seeded folder in one language) 6 (Phase 4); one banking project problem per language (Phase 8); 7 security and AI/LLM problems, 8 backend TypeScript projects, 11 memory and retrieval problems in Python and TypeScript, a search box with keyboard navigation in all six languages, a hash-chaining ledger, 3 problems on trees, graphs and terrain, a redaction project in Python, 5 knowledge representation problems, a content-addressed store, 9 AI engineering problems in Python and TypeScript, 7 data engineering problems, an architecture checker, 5 infrastructure as code problems, 3 security problems and 2 machine learning problems in Python and TypeScript, 2 testing problems, 3 networking problems, 2 operating systems problems, a sorting workbench, 3 language and editor problems, 2 database internals problems, 4 distributed systems problems, 2 platform problems, 3 internals problems: a regex engine, a query planner and a memory allocator, and 2 more AI engineering problems in Python and TypeScript: agent job workers and a grounded memory store (Phase 13); 20 service projects, graded over HTTP in a Docker sandbox (Phase 12)
lld Object-oriented and low-level design API by ops tests; design by rubric problems/ design plus rubric.md 8 (Phase 4)
concurrency Concurrency yes, per language subset problems/ concurrent 6 (Phase 5)
debugging Debugging yes problems/ function or design with stub: buggy 8 (Phase 6); 7 JavaScript traps (Phase 13)
system-design System design no (rubric) problems/ system-design 10 (Phase 6)
code-review Code review no (rubric) problems/ code-review 6 (Phase 6)
behavioral Behavioral no none guidance only 0 problems

Placement rule: every problem lives in problems/<slug>/, whatever checks it. Slugs are unique, because they are directory names and progress.db keys on the slug.

How a problem is checked is not a field of meta.yaml. checked_by is derived: tests for every autograded kind, rubric for a folder with a rubric.md, so a lld problem is both and a system-design or code-review problem is rubric (Checked by). A problem is named in the JSON documents and the web API by its canonical ID, problem/<slug>.

Track notes

Track Notes
practical Modeled on multi-level assessments: one class, 4 levels, each extending the API (example: in-memory database with set/get, then prefix scans, then TTL, then point-in-time history). Time is always an explicit timestamp argument. Candidates: in-memory database, banking ledger, file storage with quotas, task scheduler, key-value store with nested transactions, API gateway with rate limits
lld Ops tests check the public behavior; rubric.md lists design criteria (responsibilities, extension points, patterns, testability) used for self-review after cstudy done, then the reference design; cstudy solution shows it before the code (format). Candidates: parking lot, rate limiter, event bus, LFU cache, logger with sinks, vending machine, elevator controller, library checkout
concurrency Language differences are the content: Java platform and virtual threads and java.util.concurrent; Kotlin threads (coroutines as explanation sections, PRD Q5); Python threading under the GIL or asyncio; TypeScript async concurrency on the event loop (no worker_threads). Each problem lists its languages and a model per language; format and verdict rules in problem-format. Phase 5 problems: below
debugging Buggy code per language in buggy/solution.<ext>; the user fixes it until tests pass. Bugs may be language-specific (integer overflow, mutable default arguments, boxed equality), so languages may be a subset
system-design Prompt, scale assumptions, rubric and a reference design. The problems reference public articles and, optionally, sections of a distributed-systems study guide under your study-guides root (fundamentals, databases, messaging, storage, networking, observability, example designs). Candidates: URL shortener, distributed rate limiter, news feed, chat, distributed cache, notification system, web crawler, metrics ingestion, payment ledger, job scheduler
code-review A diff or small set of files plus a prompt ("review this PR"); reference.md lists the issues a strong reviewer finds, by severity
behavioral The catalog holds no content: prepare from your own story bank, which stays outside this repository. Write your stories by theme (conflict, failure, leadership, ambiguity, impact), each in a situation, task, action and result shape; map common questions to the story that answers them best; keep the bank with your other study guides, under your study-guides root. The track has no problems, notes or scheduling, so cstudy next --track behavioral reports nothing in scope, and no story-bank content belongs in this repository

Concurrency problems

The 6 Phase 5 problems and their model per language (-: not listed in languages).

Slug Java Kotlin Python TypeScript Core skill Broken references (bug classes)
bounded-blocking-queue threads threads threads async Condition waits, while re-checks, FIFO hand-off no lock; if instead of while
thread-safe-lru-cache threads threads threads - Making a compound structure atomic; lock granularity no lock; lock on get only
token-bucket-limiter threads threads threads - Atomic check-then-act with explicit timestamps; exact grant counts unsynchronized refill and take
read-write-lock threads threads threads async Shared versus exclusive access, writer preference (probe sections) reader count without a lock; writer enters while readers hold
bank-transfers threads threads threads - Deadlock avoidance by lock ordering; conservation invariants (sum) no lock; locks taken in argument order (STALLED)
concurrency-limiter threads threads async async Counting semaphore, at most k holders (max_occupancy), FIFO fairness if instead of while; release without a waiter hand-off

worker-pool and async-promise-pool from earlier drafts are folded into concurrency-limiter: the type DSL has no function values, so a pool that runs caller-supplied tasks cannot be expressed, and limiting concurrency is the part interviews probe. TypeScript is omitted where a correct and a broken solution behave identically on one event loop (synchronous methods are atomic there).

Rubric-checked problems

The problems of the kinds system-design and code-review are checked against a rubric, by you; nothing grades them automatically. The rules that make them problems are in compatibility. With the AI preview on, an AI review reads your notes against the rubric and gives a verdict per criterion, labeled AI review; it never changes the grade, which stays your own rating, and nothing changes for those who do not use it (ADR 0029).

AI review reads rubric.md as written: each - [ ] <criterion> line is one criterion, numbered across the areas in order, and the file's SHA-256 is the rubric version a review records. Criteria that name specific points, as review-payment-retry's name each planted issue, are what let a review judge an answer without reference.md, which is never sent.

problems/<slug>/              # kind: system-design
  meta.yaml       # validated by schemas/meta.schema.json
  prompt.md       # the question, functional and non-functional requirements, scale
  rubric.md       # checklist of what a strong senior or staff answer covers
  reference.md    # reference answer, revealed by cstudy solution
  template.md     # copied to notes/<track>/<slug>.md by cstudy start
problems/<slug>/              # kind: code-review
  meta.yaml, prompt.md, rubric.md, reference.md, template.md
  change.diff     # or files/ with the code under review

Every directory directly inside problems/ is a problem, and its name is the slug; its kind says whether tests or a rubric check it.

# yaml-language-server: $schema=../../schemas/meta.schema.json
slug: url-shortener
title: URL Shortener
track: system-design          # equals kind
kind: system-design           # system-design or code-review
difficulty: medium
domains: [backend]            # what it is about; required in the catalog (S24), see Labels
job_roles: [backend, platform]  # who it is for; required in the catalog
scope: system                 # system for system-design, function for code-review; required in the catalog
estimate_minutes: 45
status: draft                 # draft or ready
order: 1                      # optional curriculum order within the track (default 1000)
references:                   # optional
  study_guides:               # relative to the user's study-guides root, optionally with a #section anchor
    - "distributed-systems-study-guide.md#databases"
  links: [https://example.com/article]
related: [distributed-cache]  # optional slugs of problems

Each Markdown file starts with a # title and uses ## sections; cstudy verify enforces the sections below in this order (extra sections are allowed, except in a code review reference) and rejects TODO in the prompt, rubric and reference (checks).

File Title Required ## sections
prompt.md # <title> system design: Question, Functional requirements, Non-functional requirements, Scale; code review: Context, Task
rubric.md # <title>: Rubric One or more areas (any titles), each with at least one - [ ] <criterion> line
reference.md # <title>: Reference system design: Requirements, Estimates, API, Data model, High-level design, Deep dives, Trade-offs; code review: only severities, most severe first, from Blocker, Major, Minor, Nit, each listing - issues (at least one severity)
template.md # <title>: Notes At least one; usually the reference's sections with empty bodies or <!-- guidance --> comments, so self-review compares section by section

A code review problem carries exactly one of change.diff (a unified diff, not empty) or files/ (the files under review); a system design problem carries neither. cstudy start renders the prompt to .statements/<slug>.md and appends the change: the diff in a diff block, or each file of files/ in a block named after its extension.

Write a code review change yourself (original code, never copied from a real project), small enough to review in the problem's estimate_minutes, and plant issues across severities. Each reference.md issue names its location first, for example - `charge`: retrying a POST without an idempotency key can charge twice.

The notes template of a system design problem is the reference's sections with empty bodies:

# <title>: Notes

## Requirements

<!-- Functional and non-functional requirements you clarified, with the numbers you assume. -->

## Estimates

## API

## Data model

## High-level design

## Deep dives

## Trade-offs

and that of a code review problem the severities:

# <title>: Notes

## Blocker

## Major

## Minor

## Nit

List public sources in references.links and, optionally, sections of your own study guide in references.study_guides, relative to your study-guides root. status: ready needs at least one of the two for a system design problem. Never copy a guide's content into the problem.

Study guides

Study guides are your own notes, kept outside this repository and never copied into it. Set their directory as root in the [study_guides] table of the user config; references.study_guides paths are relative to it. The bundled rubric problems reference sections of distributed-systems-study-guide.md; any guide file you place at that path under your root is linked.

When the root is set, cstudy start and cstudy show list every referenced guide whose file exists under it, in a final ## Study guides section of the statement, as a file:// link that keeps the #section anchor; cstudy start also prints one guide line per link. Without a root, or for a missing file, nothing is shown and nothing fails.

Labels

Three labels say what a problem is about, who it is for and how big the thing you work on is. They are independent of the track, of kind and of difficulty: a project can be easy and a function hard, and a security problem is practical or debugging with domains: [security], not a track of its own. The lists are closed, since free-form tags drift into near-duplicates. A value is added deliberately, by a change to its table here, to DOMAINS, JOB_ROLES or Scope in domain/taxonomy.py and to the $defs of schemas/meta.schema.json; a fast test holds the module and the schema equal (ADR 0020).

Label Field How many Answers
Domain domains One or more What subject is it about?
Role job_roles One or more Who is it for?
Scope scope Exactly one How big is the thing you work on?
domains value Meaning
algorithms Data structures and algorithms, language pitfalls
backend Services, APIs, data, design of backend components
security Authorization, tenancy, validation, defensive engineering
identity Tokens, sessions, login flows, provisioning
ai-llm The code around models: clients, retrieval, evaluation, cost
fintech Money, ledgers, insurance
data Data engineering: pipelines, streams, tables, quality, lineage
infrastructure Infrastructure as code, configuration, deployment tooling
systems Operating systems, networking, distributed systems mechanics
software-design Testing, refactoring, design patterns, architecture
frontend Browser UI, state, rendering, accessibility
job_roles value Meaning
general Any software engineer, so that the 212 algorithm rows need not list every role
backend Backend engineers
platform Platform and infrastructure engineers
security-engineer Security engineers
ai-engineer Engineers who build on models
ml-engineer Engineers who train and evaluate models
data-engineer Engineers who build and run data pipelines and tables
frontend Engineers who build browser UIs

Concept guides carry domains and job_roles too, from the same lists and chosen by the labeling rule of guides, and no scope; schemas/guide.schema.json holds the same $defs as schemas/meta.schema.json, and the same fast test holds it equal to domain/taxonomy.py. The learner profile narrows lists by the domains and roles a learner chooses, by the matching rules: an entry that lists general matches every role profile, since it is for any engineer, so general is not a value of the profile.

scope value Meaning Fits
function One function or class, in one file, with no folder or process of yours kind function, design, progressive or concurrent, and code review problems
project A folder of files kind: project
system Several services; today the design discussions of the system-design problems system-design problems, and a kind: project problem that builds several services (none yet)

cstudy list and cstudy next filter by them with --domain, --role and --scope, each one value that matches any listed value (cli), and the Problems view does the same (web-ui). --role X matches only entries that list X, so an entry for security engineers keeps a short list and the filter stays useful.

In the schemas the fields are optional, and check S24 requires them on catalog content only (authoring): a problem of your own in the workspace works without them and is listed with - for each. When it names a scope, the scope has to fit its kind. cstudy new writes the labels of its template, which you edit to fit the problem:

Template domains job_roles scope
array, tree, design algorithms general function
progressive backend backend function
concurrent backend backend, platform function
project-* backend backend project

The catalog lists the labels of every row.

Pattern taxonomy

The seed is a personal study list, not part of this repository: 73 problems in 15 sections plus Binary Search (704) and Best Time to Buy and Sell Stock (121) from its study order, 75 in total. The taxonomy keeps its 15 patterns, splits Stack into Stack and Monotonic Stack/Deque, splits Graphs into Graphs, Topological Sort and Advanced Graphs, splits DP into 1D and 2D, and adds Union-Find, Prefix Sum, Math and Geometry, and Segment Tree/Fenwick.

The order below is the taxonomy order used for tie-breaks in cstudy next. Counts are by primary pattern.

# Pattern id Seed Phase target Example additions (LeetCode reference numbers)
1 arrays-hashing 5 12 Contains Duplicate (217), Valid Anagram (242), Encode and Decode Strings (271), Valid Sudoku (36)
2 two-pointers 4 8 Two Sum II (167), Move Zeroes (283), Sort Colors (75)
3 sliding-window 5 8 Minimum Size Subarray Sum (209), Fruit Into Baskets (904)
4 stack 3 6 Generate Parentheses (22), Basic Calculator II (227)
5 monotonic-stack 2 6 Car Fleet (853), Online Stock Span (901), Sum of Subarray Minimums (907)
6 binary-search 6 10 Time Based Key-Value Store (981), Split Array Largest Sum (410)
7 linked-list 5 10 Remove Nth Node From End (19), Copy List with Random Pointer (138), LRU Cache (146)
8 trees 7 16 Same Tree (100), Subtree of Another Tree (572), Kth Smallest in BST (230), Construct Tree from Traversals (105), Right Side View (199)
9 tries 3 4 Longest Word in Dictionary (720)
10 heap 4 8 Last Stone Weight (1046), Design Twitter (355), IPO (502)
11 backtracking 5 10 Subsets II (90), Combination Sum II (40), Palindrome Partitioning (131), Letter Combinations (17)
12 graphs 3 12 Max Area of Island (695), Rotting Oranges (994), Surrounded Regions (130), Word Ladder (127)
13 topological-sort 2 4 Course Schedule II (210), Parallel Courses (1136)
14 advanced-graphs 1 8 Min Cost to Connect Points (1584), Cheapest Flights Within K Stops (787), Swim in Rising Water (778), Reconstruct Itinerary (332)
15 union-find 0 5 Number of Connected Components (323), Redundant Connection (684), Accounts Merge (721)
16 dp-1d 6 12 Decode Ways (91), Word Break (139), Palindromic Substrings (647), House Robber II (213)
17 dp-2d 2 12 Edit Distance (72), Coin Change II (518), Interleaving String (97), Distinct Subsequences (115), Burst Balloons (312)
18 greedy 5 8 Jump Game II (45), Maximum Subarray (53), Valid Parenthesis String (678)
19 intervals 4 6 Meeting Rooms (252), Minimum Interval to Include Each Query (1851)
20 prefix-sum 0 6 Subarray Sum Equals K (560), Range Sum Query Immutable (303), Continuous Subarray Sum (523)
21 math-geometry 0 6 Rotate Image (48), Spiral Matrix (54), Pow(x, n) (50), Multiply Strings (43)
22 bit-manipulation 3 5 Reverse Bits (190), Missing Number (268), Sum of Two Integers (371)
23 segment-tree-fenwick (stretch) 0 3 Range Sum Query Mutable (307), Count of Smaller Numbers After Self (315)
24 sorting 0 none yet Sorting algorithms, custom orderings, sort-then-scan
25 string-matching 0 none yet Substring search, rolling hashes, pattern and wildcard matching
26 recursion 0 none yet Recursive decomposition and divide and conquer, without a search or a table
Total 75 185

Patterns 24 to 26 were added by ADR 0020 with no problems, so the seed and phase targets above count 23 patterns and the totals do not include them. They follow the first 23 in the tie-break order, so the order of the others does not change. Problems may list secondary patterns (for example Sliding Window Maximum: sliding-window, monotonic-stack); cstudy list --pattern matches any listed pattern.

Content batches

Each batch is merged only when all its problems are ready and pass cstudy verify --oracle (and --ladder from Phase 2 on).

Batch Phase Patterns Problems
1 1 arrays-hashing, two-pointers, sliding-window, stack 34
2 3 binary-search, linked-list, monotonic-stack, intervals 32
3 3 trees, tries, heap 28
4 3 backtracking, graphs, topological-sort, union-find 31
5 3 dp-1d, dp-2d, greedy 32
6 3 advanced-graphs, prefix-sum, math-geometry, bit-manipulation, segment-tree-fenwick 28

Copyright policy

LeetCode statements, examples, test data, editorials and community solutions are copyrighted. Decision: ADR 0004.

Aspect Rule
Statement Written from scratch in own words and structure; never pasted or paraphrased sentence by sentence
Examples and tests Own values; never copied from the original problem
Title Common problem names (for example "Two Sum") are allowed
Signature and names May match LeetCode for recognition (function names are not creative expression)
Reference meta.yaml references.leetcode links to the original
Solutions and explanations Own work; never copied from editorials or discussion posts
Personal study guides Referenced by a path relative to the user's study-guides root; their content is never copied into the repository