Skip to content

Latest commit

 

History

50 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

leetcode-rs

Book

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:

  1. Create book/src/pNNNN_title.md with an {{#include ../../src/problems/pNNNN_title.rs:START:END}} block pointing at the relevant line range (exclude the #[cfg(test)] block).
  2. 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 = true is set in book.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/).

Ownership rules

  1. Every value has exactly one owner at a time.
  2. When the owner goes out of scope, the value is dropped (freed) — no GC needed.
  3. You can either have one mutable reference OR any number of read-only references to a value — never both at once.

Releases

Packages

Contributors

Languages