Skip to content

Q-Peppa/LeetCode

Repository files navigation

LeetCode JavaScript Solutions

A personal collection of LeetCode solutions and contest submissions in JavaScript, plus reusable utilities for common data structures.

Note

This repository is focused on practice and reference. There is no automated test framework; solutions are verified with manual runs.

Repository structure

  • src/ — individual problem solutions (one file per problem id)
  • src/utils/ — reusable data structures (e.g., segment tree, union-find)
  • src/contest/ — weekly and biweekly contest submissions
  • contest/ — additional contest archives

Getting started

Prerequisites:

  • Node.js 22.x
  • pnpm (recommended)

Install dependencies:

pnpm install

Run a solution

Run any solution file directly with Node.js:

node src/1.js

You can also add quick manual checks inside a solution file using console.log and run it the same way.

Tip

Use problem id files under src/ for main solutions, and src/contest/ for contest entries.

Formatting and linting

This project uses Biome for formatting and linting.

# Format all JS files in src
pnpm biome-fix

# Lint without writing changes
biome check src

Conventions

  • Solutions use var functionName = function (...) {} for LeetCode compatibility.
  • JSDoc comments are used for function signatures.
  • Indentation is 2 spaces; single quotes and semicolons are required.

Dependencies

Important

Prefer built-in JavaScript features. External libraries are used only when they simplify complex data structures.

About

LeetCode

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •