$ show ishaanbuildsthings/leetcode
This repository is a large, personal competitive programming solution archive spanning multiple platforms (LeetCode, Codeforces, CSES, AtCoder, etc.) with a companion Next.js web application (LeetGoat) for managing and browsing problems. The codebase contains over 3,900 files, predominantly short algorithmic solution scripts in Python, C++, and JavaScript, accompanied by reusable algorithm templates and a structured problem metadata system using Prisma and Supabase. While the primary content is the solution library, the integrated web application provides authentication, admin CRUD for problems and tags, drill grouping, and practice pages. The app uses tRPC for type-safe APIs, Supabase for auth, and Prisma for database access. However, many site pages are placeholders ("Coming Soon"), indicating an early-stage product. Code quality varies widely: many solutions are well-commented and demonstrate strong algorithmic thinking (DP, segment trees, graph algorithms), while others are incomplete, contain known bugs, or carry disclaimers like "BAD SOLUTION". The templates directory contains genuinely reusable components (sparse tables, DSU, segment trees, centroid decomposition) that could be extracted for other projects. Maintenance is ongoing with frequent commit activity, but the sheer volume and mixed concerns (solutions + web app) introduce technical drift. No testing suite or CI is evident, and some solutions depend on external libraries (sortedcontainers) not always available in competitive programming environments.
The LLM identified 6 files worth highlighting for reuse:
A C++ template for generic sparse tables supporting O(1) range queries on idempotent operations (min, max, gcd). Implements a compile-time generic combine function, making it portable and reusable across different data types and operations.
A standard Disjoint Set Union implementation with path compression and union by size. Clean, well-commented, and self-contained. Easily extracted for graph connectivity problems.
Python implementation of reroot dynamic programming to compute the sum of distances from each node to all others in a tree. Demonstrates a clean two-pass DFS pattern (first compute size and initial sum, then propagate to children). Reusable for any tree distance problem.
Iterative segment tree for point assignments and range sum queries in O(log n). The code is concise and avoids recursion overhead, making it suitable for performance-critical contexts. Includes an adaptive size for powers of two.
A collection of 8 Python helper functions for monotonic stack patterns: next/previous greater/smaller element and their strict/non-strict variants. Each function is self-contained and named clearly, allowing direct reuse in array problems.
A React Nav component that provides a responsive navbar with links to Interview Prep, Competitive Programming, Admin, and external Discord. Uses Next.js Link and active path highlighting. Demonstrates a clean separation of navigation state from page content.