Datasets:
Tasks:
Text Generation
Modalities:
Text
Formats:
parquet
Languages:
English
Size:
10K - 100K
Tags:
code
License:
license: cc-by-sa-4.0 | |
task_categories: | |
- text-generation | |
language: | |
- en | |
tags: | |
- code | |
pretty_name: Doocs LeetCode Solutions | |
size_categories: | |
- 10K<n<100K | |
# Doocs LeetCode Solutions | |
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. | |
## Description | |
- Repository: [Doocs LeetCode Solutions](https://github.com/doocs/leetcode) | |
- Total Problems: 3500+ | |
- Total Solutions: 15,000+ (across multiple languages) | |
- Size: ~60 MB (Parquet format) | |
- Languages: | |
- C | |
- Cangjie | |
- C++ | |
- C# | |
- Dart | |
- Go | |
- Java | |
- JavaScript | |
- Kotlin | |
- Nim | |
- PHP | |
- Python | |
- Ruby | |
- Rust | |
- Scala | |
- Bash | |
- SQL | |
- Swift | |
- TypeScript | |
## 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` | 3500+ | 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). |