Solve LeetCode problems in Typst with beautiful PDF output, built-in test cases, and automatic visualization.

Beautiful Visualizations

The Skyline Problem visualization
#0218 The Skyline Problem
Gradient sky, colored buildings with windows, and red skyline contour
Trapping Rain Water II 3D visualization
#0407 Trapping Rain Water II
3D isometric view with terrain and water blocks
Trapping Rain Water visualization
#0042 Trapping Rain Water
Gradient terrain with highlighted water accumulation
Container With Most Water visualization
#0011 Container With Most Water
Two-pointer solution with optimal container highlight
69
Problems Included
100%
Built-in Test Cases
0
Setup Required

Why LeetCode.typ?

๐Ÿš€

Zero Configuration

Import the package and start solving. All test cases are built-in and ready to use.

โœจ

Beautiful Output

Professional PDF rendering with syntax highlighting, tree visualization, and more.

๐Ÿงช

Auto Validation

Instant pass/fail indicators with side-by-side comparison of expected vs actual.

๐ŸŒณ

Data Structures

Visual rendering for binary trees, linked lists, and chessboards.

๐Ÿ“

Functional Style

Explore algorithms with Typst's expressive functional programming syntax.

๐Ÿ”ง

Extensible

Custom comparators, extra test cases, and flexible rendering options.

Problem Collection

Difficulty:

Quick Start

solution.typ
// Import the package
// For local development, use lib.typ directly
#import "lib.typ": problem, test

// Display the problem
#problem(1)

// Write your solution
#let solution(nums, target) = {
  let d = (:)
  for (i, num) in nums.enumerate() {
    if str(target - num) in d {
      return (d.at(str(target - num)), i)
    }
    d.insert(str(num), i)
  }
}

// Test with built-in cases!
#test(1, solution)

Ready to Start?

Download the complete PDF with all 69 problems and reference solutions.