Skip to content

Repository files navigation

Algorithms 1001 Nights

1001-nights

A thousand tiny steps turn into LC legend!

this repo records each step as a solution so the grind eventually makes you the algorithm sage you’re chasing. Every src/<topic> folder carries a guide plus implementations and Jest specs, letting you move from idea to proof without pausing to hunt for context.

Repository layout

  • src/<topic>/<problem-id-name>/: Source, Jest spec, and optional notes for each puzzle (e.g. src/array/189-rotate-array/189.ts).
  • src/<topic>/readme.md: Topic playbook that explains the approach for that data structure/question type.
  • build/src/...: Generated JavaScript after npm run compile. Never edit the build artifacts directly.
  • static/: Diagrams and supporting material such as static/img/binary-tree/review.png.
  • Scripts: npm run compile (tsc to build/), npm run test (compile + Jest + lint), npm run lint (gts checks), and npm run fix (auto-format).

Topic guides

Learning workflow

  • Pick a problem, open its folder under src/<topic>/<problem-id-name>/, and read the topic guide in src/<topic>/readme.md.
  • Implement or update the solution in <id>.ts with the recommended pattern (two pointers, BFS, etc.).
  • Keep changes type-safe: npm run compile surfaces TypeScript errors even before running tests.
  • When exploring new ideas, capture strategy notes in a local README.md inside the problem folder.

Adding or updating unit tests

  1. In src/<topic>/<problem-id-name>/, locate the existing <id>.spec.ts or create a new one beside the solution file.
  2. Import the exported function(s) from <id>.ts.
  3. Use Jest describe blocks named after the problem and include it cases for happy paths, edge cases, and regressions.
  4. Run npm run test -- <pattern> to focus on a single spec or npm run test for the full suite.

About

LeetCode算法的一千零一夜

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages