Datasets:
Tasks:
Text Generation
Modalities:
Text
Formats:
parquet
Languages:
English
Size:
10K - 100K
Tags:
code
License:
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,100 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: cc-by-sa-4.0
|
| 3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-sa-4.0
|
| 3 |
+
---
|
| 4 |
+
|
| 5 |
+
# Doocs LeetCode Solutions
|
| 6 |
+
|
| 7 |
+
[](http://creativecommons.org/licenses/by-sa/4.0/)
|
| 8 |
+
[](https://huggingface.co/datasets)
|
| 9 |
+
|
| 10 |
+
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.
|
| 11 |
+
|
| 12 |
+
## Dataset Description
|
| 13 |
+
|
| 14 |
+
- **Repository:** [Doocs LeetCode Solutions](https://github.com/doocs/leetcode)
|
| 15 |
+
- **Total Problems:** 2000+
|
| 16 |
+
- **Total Solutions:** 10,000+ (across multiple languages)
|
| 17 |
+
- **Size:** ~60 MB (Parquet format)
|
| 18 |
+
- **Last Updated:** 29 July 2025
|
| 19 |
+
|
| 20 |
+
## Dataset Structure
|
| 21 |
+
|
| 22 |
+
### Data Fields
|
| 23 |
+
|
| 24 |
+
| Field | Type | Description | Example |
|
| 25 |
+
|---------------|------------|--------------------------------------------|----------------------------------|
|
| 26 |
+
| `id` | `string` | Problem ID | "0001" |
|
| 27 |
+
| `title` | `string` | Problem title (slugified) | "two-sum" |
|
| 28 |
+
| `difficulty` | `string` | Problem difficulty level | "Easy", "Medium", "Hard" |
|
| 29 |
+
| `description` | `string` | Problem description in Markdown | "Given an array of integers..." |
|
| 30 |
+
| `tags` | `string` | Problem category tags | "Array; Hash Table" |
|
| 31 |
+
| `language` | `string` | Programming language of solution | "Python", "Java", "C++" |
|
| 32 |
+
| `solution` | `string` | Complete solution code | "class Solution:\n def..." |
|
| 33 |
+
|
| 34 |
+
### Data Splits
|
| 35 |
+
|
| 36 |
+
The dataset contains a single comprehensive split containing all problems and solutions:
|
| 37 |
+
|
| 38 |
+
| Split | Problems | Solutions |
|
| 39 |
+
|---------|----------|-----------|
|
| 40 |
+
| `train` | 2500+ | 15,000+ |
|
| 41 |
+
|
| 42 |
+
## How to Use
|
| 43 |
+
|
| 44 |
+
### Using Hugging Face `datasets` Library
|
| 45 |
+
|
| 46 |
+
```python
|
| 47 |
+
from datasets import load_dataset
|
| 48 |
+
|
| 49 |
+
# Load the dataset
|
| 50 |
+
dataset = load_dataset("olegshulyakov/doocs-leetcode-solutions")
|
| 51 |
+
|
| 52 |
+
# Access a sample
|
| 53 |
+
sample = dataset['train'][0]
|
| 54 |
+
print(f"Problem {sample['id']}: {sample['title']}")
|
| 55 |
+
print(f"Difficulty: {sample['difficulty']}")
|
| 56 |
+
print(f"Tags: {sample['tags']}")
|
| 57 |
+
print(f"Language: {sample['language']}")
|
| 58 |
+
print(f"Solution:\n{sample['solution']}")
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
## Dataset Creation
|
| 62 |
+
|
| 63 |
+
### Source Data
|
| 64 |
+
- Collected from [Doocs LeetCode](https://github.com/doocs/leetcode) repository
|
| 65 |
+
- Solutions cover 14+ programming languages
|
| 66 |
+
- Includes problems from LeetCode's entire problem set
|
| 67 |
+
|
| 68 |
+
### Preprocessing
|
| 69 |
+
1. Repository cloned and processed using our [dataset generator tool](https://github.com/olegshulyakov/leetcode-dataset-generator).
|
| 70 |
+
2. Metadata extracted from README_EN.md files.
|
| 71 |
+
3. Solution files parsed and mapped to programming languages.
|
| 72 |
+
4. Special characters and encoding issues resolved.
|
| 73 |
+
|
| 74 |
+
## Intended Use
|
| 75 |
+
|
| 76 |
+
### Primary Use
|
| 77 |
+
- Fine-tuning code generation models
|
| 78 |
+
- Training programming problem-solving AI
|
| 79 |
+
- Educational purposes for learning algorithms
|
| 80 |
+
|
| 81 |
+
### Possible Uses
|
| 82 |
+
- Benchmarking code generation models
|
| 83 |
+
- Studying programming patterns across languages
|
| 84 |
+
- Analyzing problem difficulty characteristics
|
| 85 |
+
- Creating programming tutorials and examples
|
| 86 |
+
|
| 87 |
+
### Limitations
|
| 88 |
+
- Solutions may not be optimal (community solutions)
|
| 89 |
+
- Some edge cases might not be covered
|
| 90 |
+
- Problem descriptions may contain markdown/html formatting
|
| 91 |
+
- Limited to problems available in the Doocs repository
|
| 92 |
+
|
| 93 |
+
## License
|
| 94 |
+
This dataset is licensed under the **CC-BY-SA-4.0 License** - see [LICENSE](LICENSE) file for details.
|
| 95 |
+
|
| 96 |
+
## Copyright
|
| 97 |
+
The copyright of this project belongs to [Doocs](https://github.com/doocs) community.
|
| 98 |
+
|
| 99 |
+
## Contact
|
| 100 |
+
For questions or issues regarding the dataset, please open an issue on [GitHub](https://github.com/olegshulyakov/leetcode-dataset-generator/issues).
|