This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
LeetCode practice solutions in C, C++, and Python. Each file in src/ is a standalone solution named after its function/approach, with the LeetCode problem number in a comment at the top.
Do not add, modify or suggest changes to the solution code unless explicitly asked. Do not attempt to build or execute the code—the user will do this. Only do one of the following based on the prompt:
When writing tests, follow the existing pattern:
- Use
assertstatements in amain()function for C++ - For Python, create a pytest-style test file in
tests/named{moduleName}_test.py:- Import with
from src.{moduleName} import Solution - Create a module-level
s = Solution()instance - Write plain
def test_*()functions withassertstatements (no unittest classes)
- Import with
- For TypeScript use "node:assert" with // @ts-ignore
- Include test cases from the problem description on leetcode (don't try to fetch) no need to make up your own
- Put headers at top of file
Write the logic/strategy as a block comment. Make sure to include main problem tag (eg. sliding window, two pointers, etc). Also include the overall time complexity and reasoning.
- For python put the logic in a docstring as a module comment
- For C put the logic in a javadoc style comment
- Block comment should include overall time complexity and memory complexity
- Use the variable
nwhen it makes sense, i.e. O(n), otherwise explain the variable - Don't try to fetch anything
- Don't write the problem description