This dataset contains the solutions to the problems on LeetCode.
- Update Frequency: At least one problem every day.
- Language: TypeScript
- Model: Solutions and explanations are generated using
Anthropic's Claude Sonnet 4.6(Old solution use OpenAI'sGPT-5andGPT-5-Thinkingmodels) with human cleanup. - Question Code Source: TypeScript starter code is extracted from the whiskwhite/leetcode-complete dataset. Missing problems not covered by this dataset are manually collected to ensure completeness.
The approach to solving and optimizing LeetCode problems follows this process with optimization_prompt.md prompt:
- Create a basic solution that correctly solves the problem
- Leverage
Claude 4.6 Sonnetmodel to iteratively optimize the solution using a specialized prompt
The optimization flow works as follows:
flowchart TD
A[Create Basic Solution] --> B[Submit to LeetCode]
B --> C[Record Execution Time/Performance]
C --> D[Send to o4-mini-high with Optimization Prompt]
D --> E[Get Optimized Solution]
E --> F[Submit to LeetCode]
F --> G{Is Performance Better?}
G -->|Yes| H[Set as Current Best Solution]
H --> D1[Start New Chat Session]
D1 --> D
G -->|No| I{Execution Error?}
I -->|Yes| J[Get Error Feedback]
J --> E
I -->|No| K[Provide Performance Feedback]
K --> E
G -->|Same Performance & Beats 100%| L[Stop Optimization]
L --> M[Generate Solution Explanation]
M --> N[Refine Solution with GPT-4.5/4.1]
N --> O[Manual Human Cleanup]
style A fill:#d0f0c0
style L fill:#f0c0c0
style H fill:#c0d0f0
style D1 fill:#c0f0f0
style M fill:#f0e0c0
style N fill:#e0c0f0
style O fill:#c0e0f0
The optimization process continues iteratively with these important rules:
- When a better solution is found, we always start a new chat session with the improved solution as the new baseline
- Error fixes and performance feedback continue in the same chat session
- We only stop iterations when the solution reaches 100% runtime efficiency AND new optimization attempts yield the same performance (bottleneck reached)
- The process aims to push solutions to their theoretical limits through continuous refinement
After optimization is complete, the following additional steps are performed:
-
Generate Solution Explanation: Use the solution prompt in solution_prompt.md with the
Claude 4.6 Sonnetmodel to create detailed solution steps and explanations -
Solution Refinement: Leverage
Claude 4.6 Sonnetto refine the generated solution explanations for clarity and completeness -
Manual Review and Cleanup: Perform a human review of the solution markdown to ensure:
- Technical correctness of the solution
- Proper formatting of the output
- Clarity of explanations
- Consistency with the repository standards
If you find this dataset useful, please consider citing it in your work:
@misc{twleetcode2025,
title = {tw-leetcode: Traditional Chinese High-Quality LeetCode Solution Dataset},
author = {Ren-Di Wu, Huang Liang Hsun and Twinkle AI community},
year = {2025},
howpublished = {https://huggingface.co/datasets/lianghsun/tw-leetcode},
note = {Accessed May 2025}
}This dataset is licensed under the MIT License. You are free to use, modify, and distribute the dataset, but please provide appropriate credit to the original authors.
