--- license: mit task_categories: - text-generation language: - en pretty_name: LeetCode Code-Gen (JavaScript) size_categories: - n<1K tags: - code - javascript - leetcode - algorithms - code-generation - competitive-programming - instruction-tuning - sft --- # LeetCode Code-Gen Dataset — JavaScript 631 rows. Given a problem statement, its input/output examples, and a required algorithm/technique, generate a correct JavaScript solution. Part of a 4-language collection built from the same source: see the sibling [Python](https://huggingface.co/datasets/AmareshHebbar/leetcode-codegen-python), [Java](https://huggingface.co/datasets/AmareshHebbar/leetcode-codegen-java), [C++](https://huggingface.co/datasets/AmareshHebbar/leetcode-codegen-cpp), and [JavaScript](https://huggingface.co/datasets/AmareshHebbar/leetcode-codegen-javascript) datasets. ## Verification **Not execution-verified.** There is currently no compiler/runtime harness for this language in the build pipeline (only Python has one). Rows are extracted directly from named solution approaches in [doocs/leetcode](https://github.com/doocs/leetcode), a well-maintained community solutions repo, so correctness is likely but not guaranteed. Treat this the way you'd treat any unverified scraped code dataset. ## Source Extracted from [doocs/leetcode](https://github.com/doocs/leetcode), which documents multiple named solution approaches per problem (e.g. "Dynamic Programming", "Two Pointers", "Divide and Conquer") -- this is what makes per-row algorithm labeling possible, since the same problem can appear multiple times with a different technique and different code each time. ## Fields | field | description | |---|---| | `slug` | LeetCode problem slug | | `solution_id` | unique id: problem + approach index + language | | `primary_algorithm` | normalized algorithm/technique label | | `verified` | `true`/`false` for Python (execution-checked), `null` for other languages | | `messages` | chat-format (system/user/assistant), ready for SFT | ## Example row ```json { "slug": "house-robber", "primary_algorithm": "Dynamic Programming", "messages": [ {"role": "system", "content": "You are a competitive programming assistant..."}, {"role": "user", "content": "### Problem\n...\n### Algorithm\nDynamic Programming"}, {"role": "assistant", "content": "```javascript\n...\n```"} ] } ``` ## Known gaps - SQL/database problems excluded (wrong problem type for a code-execution harness) - Design/class problems (LRU Cache, iterators) excluded -- they need a sequence of method calls to test, not a single input -> output check - Some `Brute Force` labels are a fallback where the source didn't name a specific technique for that approach