Datasets:
Update README.md
Browse files1223456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146---license: apache-2.0license: cc-by-4.0language: - enpretty_name: LeetCode Problems Labelled by Solution Pattern (Sample)size_categories: - n<1Ktask_categories: - text-classificationtags: - code - algorithms - programming-problems - technical-interviews - leetcode - taxonomyconfigs: - config_name: default data_files: - split: train path: data/train.jsonl---
# LeetCode Problems Labelled by Solution Pattern (Sample)
A 100-problem sample of LeetCode problems annotated with the **algorithmic technique that solvesthem**, rather than the topic tag that describes what they are about.
LeetCode's own tags answer "what is this problem about" — `Array`, `String`, `Hash Table`. That isnot the same question as "how is it solved". Both *Two Sum* and *Longest Substring Without RepeatingCharacters* are tagged `Hash Table`, but one is a complement lookup and the other is a sliding windowwith a seen-set. This dataset adds a `solution_archetype` field that answers the second question.
The full corpus this sample is drawn from covers 3,000 problems across 29 archetypes.
## Dataset structure
One JSON object per line in `data/train.jsonl`:
| field | type | description || --- | --- | --- || `problem_number` | int | The problem's number on LeetCode || `title` | string | Problem title || `slug` | string | URL slug || `difficulty` | string | `Easy`, `Medium` or `Hard` || `topic_tags` | list[string] | LeetCode's own topic tags, unmodified || `solution_archetype` | string | **The annotation.** The technique that solves the problem || `has_reference_solution` | bool | Whether a worked reference solution exists for this problem || `leetcode_url` | string | Canonical problem URL on leetcode.com || `pattern_reference` | string \| null | Write-up of the archetype, where one exists |
### Sample row
```json{ "problem_number": 1, "title": "Two Sum", "slug": "two-sum", "difficulty": "Easy", "topic_tags": ["Array", "Hash Table"], "solution_archetype": "hash-map", "has_reference_solution": true, "leetcode_url": "https://leetcode.com/problems/two-sum/", "pattern_reference": "https://www.stealthinterview.ai/leetcode/patterns/hash-map"}```
### Composition of this sample
100 problems, stratified to cover as many archetypes as possible while keeping the difficulty mix ofthe source corpus: **21 Easy / 63 Medium / 16 Hard**, spanning **29 distinct archetypes**. Selectionis deterministic — problems are taken in ascending number, round-robin across archetypes — so thesample is reproducible rather than a random draw. Premium-only problems are excluded, because theirstatements are not publicly checkable.
## Usage
```pythonfrom datasets import load_dataset
ds = load_dataset("<your-username>/leetcode-solution-patterns-sample", split="train")
# Problems solved by a monotonic stackmono = ds.filter(lambda r: r["solution_archetype"] == "monotonic-stack")
# Where LeetCode's tag and the solving technique disagreemismatch = ds.filter( lambda r: "Hash Table" in r["topic_tags"] and r["solution_archetype"] != "hash-map")```
## Provenance and what is actually original here
This distinction matters, so it is stated plainly:
- **Not original, and not owned by this dataset:** problem numbers, titles, slugs, difficulty ratings and topic tags. These are factual references to problems hosted on LeetCode.- **Original:** the `solution_archetype` labels and the taxonomy of 29 archetypes they are drawn from. These were derived by analysing solution structure across the corpus and are the reason this dataset exists.
**No problem statements, test cases, editorial content or LeetCode solutions are included in thisdataset.** Only metadata and links back to the canonical problem pages. If you need the problem text,follow `leetcode_url`.
LeetCode is a trademark of its respective owner. This dataset is not affiliated with, endorsed by, orsponsored by LeetCode.
## Licence
The **annotations** — `solution_archetype` and the taxonomy — are released under[CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). Attribution is appreciated if you use thelabels in research or a downstream dataset.
The referenced problem metadata is factual information about a third-party platform and is notclaimed under this licence.
## Limitations
- **One archetype per problem.** Many problems admit more than one valid approach; the label records the technique the reference solution used, not the only one that works.- **`bespoke` is a real category, not a fallback for hard problems.** It marks problems whose solution does not generalise to a reusable pattern.- **The taxonomy is opinionated.** Where you draw the line between `stack` and `monotonic-stack`, or `dfs` and `graph-traversal`, is a judgement call. The boundaries here are consistent within the corpus but are not a standard anyone else has ratified.- **Sample, not corpus.** 100 of 3,000. Frequencies here will not match the full distribution.
## Source
Built from the problem library at[stealthinterview.ai/leetcode](https://www.stealthinterview.ai/leetcode), which organises the full3,000-problem set by solving technique. The archetype taxonomy and the per-technique write-ups —including the template, complexity and applicable problems for each — are documented at[stealthinterview.ai/leetcode/patterns](https://www.stealthinterview.ai/leetcode/patterns).
## Citation
```bibtex@misc{leetcode_solution_patterns_2026, title = {LeetCode Problems Labelled by Solution Pattern}, year = {2026}, url = {https://www.stealthinterview.ai/leetcode/patterns}, note = {Sample of 100 problems annotated with solving technique}}```README.md+144-1