DSA • Algorithms • LeetCode • Competitive Programming • Visual Editorials
Visual Lab · Contest archive · Topic guides · Editorial workflow · Contest sync
KatalCode is Kavya Katal's learning-first algorithm handbook: tested solutions paired with the intuition, failed attempts, bottlenecks, proofs, dry runs, and reusable patterns that make them useful long after submission day.
This repository favors understanding over answer collection. Every complete editorial moves through:
Intuition → Brute Force → Bottleneck → Optimization → Proof
The dist/ site lets readers choose LeetCode, Codeforces, or CodeChef, then browse documented contests and questions. Questions include concise visual explanations and interactive simulations where available. The current archive has two questions from LeetCode Weekly Contest 524; empty platform archives are shown honestly rather than listing undocumented contests.
Run it locally with no dependencies:
python3 -m http.server 8000 --directory distThen open http://localhost:8000. GitHub Pages publishes dist/. For Vercel, import this repository with the repository root as the Root Directory; vercel.json selects the static dist/ output and the Other framework preset. No build command is needed.
Solutions open as a phone- and tablet-friendly book: problem, approach, a Try it yourself compiler page, explained Python source pages, simulation, and proof. Previous/Next controls and the contents menu navigate the pages; the URL preserves the current page. The source pages use the actual solution files. After editing a solution, refresh the static source bundle with python3 scripts/build_solution_sources.py; repository validation checks that it stays current.
The Compiler page, and the Try it yourself page in every solution book, give you an editor, a custom input box and a Run button for Python 3 and Java 17. It has no test cases and no judge, on purpose: read the problem (each book links to the original statement), try an idea, and choose your own edge cases.
Everything runs in the reader's browser, so there is no server to host, pay for, or abuse, and code never leaves the device:
| Python | Java | |
|---|---|---|
| Engine | Pyodide 314.0.7 (CPython 3.14, WebAssembly) in a Web Worker | CheerpJ 5.0 (OpenJDK 17, WebAssembly), free for personal and educational use |
| First run | about 13 MB from jsDelivr, then cached | the JVM from CheerpJ's CDN, then cached; the first compile takes several seconds |
| Limits | 10 s time limit, 100,000 characters of output | a stuck run needs a page reload |
Drafts and input are saved in the browser's local storage, separately for each problem. The code lives in dist/compiler.js and dist/python-worker.mjs. A catalog entry's optional problemUrl adds the link to the original statement.
| Problem | Core pattern | Solutions |
|---|---|---|
| 4084 — Last Visited Cell in a Directional Grid | Simulation, Matrix | Optimized |
| 4085 — Find Root of a Colored Tree | Trees, Graph Orientation, Indegree, Bfs | Brute force · Optimized |
KatalCode/
├── contests/ # Contest-first archive: LeetCode, Codeforces, CodeChef
├── problems/ # Non-contest problems grouped by platform and difficulty
├── topics/ # Pattern indexes pointing to canonical editorials
├── templates/ # Editorial, contest, and metadata starters
├── scripts/ # Scaffolding, validation, indexing, and publication tools
├── docs/ # Writing standards and learning workflow
├── dist/ # Interactive visual learning site
└── .github/workflows/ # Continuous validation and GitHub Pages deployment
Start with Weekly Contest 524, browse by topic, or use the repository workflow to add a solution.
| Source | Weekly | Biweekly / Other |
|---|---|---|
| LeetCode | Weekly contests | Biweekly contests |
| Codeforces | Contest archive | — |
| CodeChef | Contest archive | — |
Non-contest LeetCode practice: Easy · Medium · Hard
Arrays · Binary Search · Graphs · Trees · Dynamic Programming · Greedy · Strings
Topic pages link to one canonical problem editorial rather than copying the solution.
The repository keeps each source editorial canonical. Create a LeetCode-ready version with rewritten public image URLs:
python3 scripts/generate_publication.py \
contests/leetcode/weekly/524/Q3-colored-tree-root/README.mdPre-rendered SVGs marked with publication-image replace Mermaid blocks for publishing targets that cannot render Mermaid. See the editorial guidelines.
# Create a contest folder
python3 scripts/new_contest.py leetcode weekly 525
# Create a problem from the standard template
python3 scripts/new_problem.py contests/leetcode/weekly/525 Q1-example "Example Problem"
# Refresh the generated featured-editorials table
python3 scripts/update_indexes.py
# Run syntax checks, unit tests, link checks, and publication smoke tests
python3 scripts/validate_repo.pyThe tools use only the Python standard library.
- GitHub — KatalKavya96
- LeetCode — KavyaKatal96
- Codeforces — profile handle not added until verified
- CodeChef — profile handle not added until verified
No rankings or activity statistics are mirrored here; the linked platforms remain the source of truth.
This is a personal learning archive, but corrections and clearer explanations are welcome. Read CONTRIBUTING.md before opening a change.
Code and original documentation are available under the MIT License.