Commit ·
20e9d68
0
Parent(s):
Duplicate from Alishohadaee/leetcode-problems-dataset
Browse filesCo-authored-by: Ali Shohadaee <Alishohadaee@users.noreply.huggingface.co>
- .gitattributes +63 -0
- README.md +211 -0
- data/train-00000-of-00001.parquet +3 -0
- raw_data/leetcode_instructions_problem_evaluator.csv +0 -0
- raw_data/leetcode_problems.csv +3 -0
- raw_data/leetcode_problems.json +3 -0
.gitattributes
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.lz4 filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.mds filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
# Audio files - uncompressed
|
| 39 |
+
*.pcm filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
*.sam filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
*.raw filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
# Audio files - compressed
|
| 43 |
+
*.aac filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
*.flac filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
*.mp3 filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
*.ogg filter=lfs diff=lfs merge=lfs -text
|
| 47 |
+
*.wav filter=lfs diff=lfs merge=lfs -text
|
| 48 |
+
# Image files - uncompressed
|
| 49 |
+
*.bmp filter=lfs diff=lfs merge=lfs -text
|
| 50 |
+
*.gif filter=lfs diff=lfs merge=lfs -text
|
| 51 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
| 52 |
+
*.tiff filter=lfs diff=lfs merge=lfs -text
|
| 53 |
+
# Image files - compressed
|
| 54 |
+
*.jpg filter=lfs diff=lfs merge=lfs -text
|
| 55 |
+
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
| 56 |
+
*.webp filter=lfs diff=lfs merge=lfs -text
|
| 57 |
+
# Video files - compressed
|
| 58 |
+
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 59 |
+
*.webm filter=lfs diff=lfs merge=lfs -text
|
| 60 |
+
leetcode_problems.csv filter=lfs diff=lfs merge=lfs -text
|
| 61 |
+
leetcode_problems.json filter=lfs diff=lfs merge=lfs -text
|
| 62 |
+
raw_data/leetcode_problems.csv filter=lfs diff=lfs merge=lfs -text
|
| 63 |
+
raw_data/leetcode_problems.json filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
task_categories:
|
| 4 |
+
- table-question-answering
|
| 5 |
+
- text-classification
|
| 6 |
+
- zero-shot-classification
|
| 7 |
+
- feature-extraction
|
| 8 |
+
- text2text-generation
|
| 9 |
+
- text-generation
|
| 10 |
+
language:
|
| 11 |
+
- en
|
| 12 |
+
tags:
|
| 13 |
+
- code
|
| 14 |
+
- AI
|
| 15 |
+
- ML
|
| 16 |
+
- NLP
|
| 17 |
+
- LLM
|
| 18 |
+
size_categories:
|
| 19 |
+
- 1K<n<10K
|
| 20 |
+
dataset_info:
|
| 21 |
+
- config_name: default
|
| 22 |
+
features:
|
| 23 |
+
- name: user_queries
|
| 24 |
+
dtype: string
|
| 25 |
+
- name: expected_output
|
| 26 |
+
dtype: string
|
| 27 |
+
splits:
|
| 28 |
+
- name: train
|
| 29 |
+
num_bytes: 5900495
|
| 30 |
+
num_examples: 2823
|
| 31 |
+
download_size: 1645957
|
| 32 |
+
dataset_size: 5900495
|
| 33 |
+
- config_name: instructions_problem_evaluator
|
| 34 |
+
features:
|
| 35 |
+
- name: user_queries
|
| 36 |
+
dtype: string
|
| 37 |
+
- name: expected_output
|
| 38 |
+
dtype: string
|
| 39 |
+
- name: __index_level_0__
|
| 40 |
+
dtype: int64
|
| 41 |
+
splits:
|
| 42 |
+
- name: train
|
| 43 |
+
num_bytes: 5923079
|
| 44 |
+
num_examples: 2823
|
| 45 |
+
download_size: 1661740
|
| 46 |
+
dataset_size: 5923079
|
| 47 |
+
- config_name: problem_evaluator
|
| 48 |
+
features:
|
| 49 |
+
- name: user_queries
|
| 50 |
+
dtype: string
|
| 51 |
+
- name: expected_output
|
| 52 |
+
dtype: string
|
| 53 |
+
- name: __index_level_0__
|
| 54 |
+
dtype: int64
|
| 55 |
+
splits:
|
| 56 |
+
- name: train
|
| 57 |
+
num_bytes: 5923079
|
| 58 |
+
num_examples: 2823
|
| 59 |
+
download_size: 1661740
|
| 60 |
+
dataset_size: 5923079
|
| 61 |
+
configs:
|
| 62 |
+
- config_name: default
|
| 63 |
+
data_files:
|
| 64 |
+
- split: train
|
| 65 |
+
path: data/train-*
|
| 66 |
+
- config_name: instructions_problem_evaluator
|
| 67 |
+
data_files:
|
| 68 |
+
- split: train
|
| 69 |
+
path: instructions_problem_evaluator/train-*
|
| 70 |
+
- config_name: problem_evaluator
|
| 71 |
+
data_files:
|
| 72 |
+
- split: train
|
| 73 |
+
path: problem_evaluator/train-*
|
| 74 |
+
---
|
| 75 |
+
|
| 76 |
+
# LeetCode Problems Dataset
|
| 77 |
+
|
| 78 |
+
This dataset contains a comprehensive collection of LeetCode programming problems along with their features, metadata, and instructions.
|
| 79 |
+
|
| 80 |
+
---
|
| 81 |
+
|
| 82 |
+
## Attribution
|
| 83 |
+
|
| 84 |
+
This dataset is derived from multiple sources:
|
| 85 |
+
1. LeetCode's website (https://leetcode.com) — All problem content, solutions, and related materials are the property of LeetCode and are those that are available publicly (No premium problem is shared!).
|
| 86 |
+
2. LeetCodeHelp (https://leetcodehelp.github.io) — Additional solution code and explanations.
|
| 87 |
+
|
| 88 |
+
This dataset is provided for educational and research purposes only. Please refer to LeetCode's Terms of Service and Copyright Policy for more information.
|
| 89 |
+
|
| 90 |
+
Original Sources:
|
| 91 |
+
- [LeetCode](https://leetcode.com)
|
| 92 |
+
- [LeetCodeHelp](https://leetcodehelp.github.io)
|
| 93 |
+
|
| 94 |
+
---
|
| 95 |
+
|
| 96 |
+
## Repository Structure
|
| 97 |
+
|
| 98 |
+
```
|
| 99 |
+
.
|
| 100 |
+
├── data/ # Parquet data for instruction-based evaluation
|
| 101 |
+
│ └── train-00000-of-00001.parquet
|
| 102 |
+
├── raw_data/ # Raw data files for manual use
|
| 103 |
+
│ ├── leetcode_instructions_problem_evaluator.csv
|
| 104 |
+
│ ├── leetcode_problems.csv
|
| 105 |
+
│ └── leetcode_problems.json
|
| 106 |
+
├── .gitattributes
|
| 107 |
+
└── README.md
|
| 108 |
+
```
|
| 109 |
+
|
| 110 |
+
---
|
| 111 |
+
|
| 112 |
+
## Datasets
|
| 113 |
+
This repository provides multiple ways to access the data:
|
| 114 |
+
|
| 115 |
+
#### 1. Instruction Problem Evaluator (LLM Fine-tuning)
|
| 116 |
+
- **Location:** `data/train-00000-of-00001.parquet`
|
| 117 |
+
- **Fields:** `user_queries`, `expected_output`
|
| 118 |
+
- **Purpose:** For training and evaluating LLMs on problem understanding and meta-reasoning
|
| 119 |
+
This dataset contains ~2823 instructions with corresponding output. The instructions are all ready to be fed to the model, if the task you want to work on is the same as the instructions defined here.
|
| 120 |
+
No further preprocessing is required on this dataset. Having said that, these instructions are based on the main crawled data, which are available at `raw_data/` directory.
|
| 121 |
+
|
| 122 |
+
> If you want to apply or study different instructions, all you have to do is to clone the raw_data, do the preprocessing and then define your own instructions. This [notebook at kaggle](https://www.kaggle.com/code/alishohadaee/leetcode-dataset-introduction) helps you get started with preprocessing.
|
| 123 |
+
|
| 124 |
+
Now, to use these instructions, first make sure `datasets` is installed and up to date:
|
| 125 |
+
```python
|
| 126 |
+
pip install -U datasets
|
| 127 |
+
```
|
| 128 |
+
|
| 129 |
+
then, load the instructions with:
|
| 130 |
+
```python
|
| 131 |
+
from datasets import load_dataset
|
| 132 |
+
ds = load_dataset("alishohadaee/leetcode-problems-dataset")
|
| 133 |
+
```
|
| 134 |
+
|
| 135 |
+
When you load the dataset using `datasets` library, this instruction dataset will be loaded to your machine, not the raw(original) data.
|
| 136 |
+
|
| 137 |
+
#### 2. Raw Data Access
|
| 138 |
+
Located in the `raw_data/` directory, you can find:
|
| 139 |
+
- `leetcode_problems.csv` and `leetcode_problems.json` - Complete, original, crawled dataset with all fields
|
| 140 |
+
- `leetcode_instructions_problem_evaluator.csv` - Instruction-based evaluation pairs (discussed earlier, this is its .csv file)
|
| 141 |
+
|
| 142 |
+
## Dataset's Fields
|
| 143 |
+
In the original dataset you will find the following columns
|
| 144 |
+
|
| 145 |
+
- `frontendQuestionId`: The ID of the problem on LeetCode
|
| 146 |
+
- `title`: The title of the problem
|
| 147 |
+
- `titleSlug`: URL-friendly version of the title
|
| 148 |
+
- `url`: URL to the problem in LeetCode
|
| 149 |
+
- `description`: Full problem description in HTML format
|
| 150 |
+
- `description_url`: URL to the problem description
|
| 151 |
+
- `difficulty`: Problem difficulty level (Easy, Medium, Hard)
|
| 152 |
+
- `paidOnly`: Boolean indicating if the problem is premium
|
| 153 |
+
- `category`: Problem category (e.g., "Algorithms")
|
| 154 |
+
- `hints`: List of hints provided for the problem by the LC
|
| 155 |
+
- `solution`: Detailed solution explanation with approaches and complexity analysis
|
| 156 |
+
- `solution_url`: URL to the problem solutions (Null value corresponds to premium solutions, this is the url to the original solution published officially by LC)
|
| 157 |
+
- `acceptance_rate`: Problem acceptance rate
|
| 158 |
+
- `topics`: List of related topics/tags
|
| 159 |
+
- `likes`: Number of likes
|
| 160 |
+
- `dislikes`: Number of dislikes
|
| 161 |
+
- `stats`: Detailed statistics including total accepted submissions and total submissions
|
| 162 |
+
- `similar_questions`: List of related problems
|
| 163 |
+
- `solution_code_url`: URL to the solution code (This the URL to the second source (`leetcodehelp.github.io`) used for retrieving Python, Java, and CPP solutions.)
|
| 164 |
+
- `solution_code_python`: Python solution code
|
| 165 |
+
- `solution_code_java`: Java solution code
|
| 166 |
+
- `solution_code_cpp`: C++ solution code
|
| 167 |
+
|
| 168 |
+
### Citation
|
| 169 |
+
If you use this dataset in your research, please cite:
|
| 170 |
+
|
| 171 |
+
```bibtex
|
| 172 |
+
@misc{leetcode_problems_dataset,
|
| 173 |
+
author = {Seyedali Shohadaeolhosseini},
|
| 174 |
+
title = {LeetCode Problems Dataset},
|
| 175 |
+
year = {2025},
|
| 176 |
+
publisher = {Hugging Face},
|
| 177 |
+
journal = {Hugging Face Hub},
|
| 178 |
+
howpublished = {\url{https://huggingface.co/datasets/Alishohadaee/leetcode-problems-dataset}}
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
@misc{leetcode,
|
| 182 |
+
author = {LeetCode},
|
| 183 |
+
title = {LeetCode - The World's Leading Online Programming Learning Platform},
|
| 184 |
+
year = {2025},
|
| 185 |
+
publisher = {LeetCode},
|
| 186 |
+
howpublished = {\url{https://leetcode.com}}
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
@misc{leetcodehelp,
|
| 190 |
+
author = {LeetCodeHelp},
|
| 191 |
+
title = {LeetCode Solutions},
|
| 192 |
+
year = {2025},
|
| 193 |
+
publisher = {LeetCodeHelp},
|
| 194 |
+
howpublished = {\url{https://leetcodehelp.github.io}}
|
| 195 |
+
}
|
| 196 |
+
```
|
| 197 |
+
|
| 198 |
+
## Usage
|
| 199 |
+
This dataset can be used for:
|
| 200 |
+
- Training language models for programming interview preparation
|
| 201 |
+
- Fine-tuning models for code generation and problem evaluation
|
| 202 |
+
- Research in programming education
|
| 203 |
+
- Development of coding assistance tools
|
| 204 |
+
- Analysis of programming problem patterns and difficulty
|
| 205 |
+
- Study of solution approaches and their effectiveness
|
| 206 |
+
- Evaluating a problem based on its description
|
| 207 |
+
|
| 208 |
+
### Updates and Versions
|
| 209 |
+
- Version 1.0.0 (Initial release)
|
| 210 |
+
- Date: May 18, 2025
|
| 211 |
+
- Description: Initial dataset release with comprehensive problem data and instruction-based evaluation pairs
|
data/train-00000-of-00001.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7733874dddd5c18829d04f6485406cfd51d6e099d0fd59fe5eb23b9bbb506166
|
| 3 |
+
size 1645957
|
raw_data/leetcode_instructions_problem_evaluator.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
raw_data/leetcode_problems.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c89021e23f3f28c90e45b60fc712e6e99ccfbecb5268fa50f21f66e9e8ea9564
|
| 3 |
+
size 18222565
|
raw_data/leetcode_problems.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ff4135eb5e030c450188f122627f17373a7cb6ad5bab76710334ae7407a8c6ef
|
| 3 |
+
size 20398443
|