Solutions are published as a static site via mdBook, pulling code directly from src/problems/*.rs (no copy-pasting into the book — the .rs files are the single source of truth).
Install once: brew install mdbook
Rebuild after adding/editing a solution:
cd book
mdbook build
Output lands in book/book/ (open book/book/index.html to view). To add a new problem to the book:
- Create
book/src/pNNNN_title.mdwith an{{#include ../../src/problems/pNNNN_title.rs:START:END}}block pointing at the relevant line range (exclude the#[cfg(test)]block). - Add it to
book/src/SUMMARY.md, with the chapter link text prefixed by the LeetCode problem number, e.g.- [242. Valid Anagram](./p0242_valid_anagram.md).no-section-label = trueis set inbook.toml, so mdBook does not auto-number sidebar entries — the number shown is whatever is in the link text, so it must match LeetCode's own numbering (not insertion order).
Preview with live reload while editing: mdbook serve (from book/).
- Every value has exactly one owner at a time.
- When the owner goes out of scope, the value is dropped (freed) — no GC needed.
- You can either have one mutable reference OR any number of read-only references to a value — never both at once.