--- license: cc-by-sa-4.0 --- # Doocs LeetCode Solutions [![License: CC-BY-SA-4.0](https://img.shields.io/badge/License-CC--BY--SA--4.0-yellow.svg)](http://creativecommons.org/licenses/by-sa/4.0/) [![Hugging Face Datasets](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Datasets-blue)](https://huggingface.co/datasets) A comprehensive dataset of LeetCode problems and solutions created from the [Doocs LeetCode](https://github.com/doocs/leetcode) repository. This dataset is designed for fine-tuning large language models to understand programming problems and generate code solutions. ## Dataset Description - **Repository:** [Doocs LeetCode Solutions](https://github.com/doocs/leetcode) - **Total Problems:** 2000+ - **Total Solutions:** 10,000+ (across multiple languages) - **Size:** ~60 MB (Parquet format) - **Last Updated:** 29 July 2025 ## Dataset Structure ### Data Fields | Field | Type | Description | Example | |---------------|------------|--------------------------------------------|----------------------------------| | `id` | `string` | Problem ID | "0001" | | `title` | `string` | Problem title (slugified) | "two-sum" | | `difficulty` | `string` | Problem difficulty level | "Easy", "Medium", "Hard" | | `description` | `string` | Problem description in Markdown | "Given an array of integers..." | | `tags` | `string` | Problem category tags | "Array; Hash Table" | | `language` | `string` | Programming language of solution | "Python", "Java", "C++" | | `solution` | `string` | Complete solution code | "class Solution:\n def..." | ### Data Splits The dataset contains a single comprehensive split containing all problems and solutions: | Split | Problems | Solutions | |---------|----------|-----------| | `train` | 2500+ | 15,000+ | ## How to Use ### Using Hugging Face `datasets` Library ```python from datasets import load_dataset # Load the dataset dataset = load_dataset("olegshulyakov/doocs-leetcode-solutions") # Access a sample sample = dataset['train'][0] print(f"Problem {sample['id']}: {sample['title']}") print(f"Difficulty: {sample['difficulty']}") print(f"Tags: {sample['tags']}") print(f"Language: {sample['language']}") print(f"Solution:\n{sample['solution']}") ``` ## Dataset Creation ### Source Data - Collected from [Doocs LeetCode](https://github.com/doocs/leetcode) repository - Solutions cover 14+ programming languages - Includes problems from LeetCode's entire problem set ### Preprocessing 1. Repository cloned and processed using our [dataset generator tool](https://github.com/olegshulyakov/leetcode-dataset-generator). 2. Metadata extracted from README_EN.md files. 3. Solution files parsed and mapped to programming languages. 4. Special characters and encoding issues resolved. ## Intended Use ### Primary Use - Fine-tuning code generation models - Training programming problem-solving AI - Educational purposes for learning algorithms ### Possible Uses - Benchmarking code generation models - Studying programming patterns across languages - Analyzing problem difficulty characteristics - Creating programming tutorials and examples ### Limitations - Solutions may not be optimal (community solutions) - Some edge cases might not be covered - Problem descriptions may contain markdown/html formatting - Limited to problems available in the Doocs repository ## License This dataset is licensed under the **CC-BY-SA-4.0 License** - see [LICENSE](LICENSE) file for details. ## Copyright The copyright of this project belongs to [Doocs](https://github.com/doocs) community. ## Contact For questions or issues regarding the dataset, please open an issue on [GitHub](https://github.com/olegshulyakov/leetcode-dataset-generator/issues).