Dataset Viewer
Auto-converted to Parquet Duplicate
slug
stringlengths
4
75
solution_id
stringlengths
20
91
primary_algorithm
stringclasses
22 values
verified
null
messages
listlengths
3
3
two-sum
two-sum__01__javascript
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven an array of integers nums and an integer target, return indice...
add-two-numbers
add-two-numbers__01__javascript
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nYou are given two non-empty linked lists representing two non-negati...
longest-substring-without-repeating-characters
longest-substring-without-repeating-characters__01__javascript
Sliding Window
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven a string s, find the length of the longest substring without d...
median-of-two-sorted-arrays
median-of-two-sorted-arrays__01__javascript
Divide and Conquer
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven two sorted arrays nums1 and nums2 of size m and n respectively...
longest-palindromic-substring
longest-palindromic-substring__01__javascript
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven a string s, return the longest palindromic substring in s.\n\n...
zigzag-conversion
zigzag-conversion__01__javascript
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nThe string \"PAYPALISHIRING\" is written in a zigzag pattern on a gi...
reverse-integer
reverse-integer__01__javascript
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven a signed 32-bit integer x, return x with its digits reversed. ...
string-to-integer-atoi
string-to-integer-atoi__01__javascript
String
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nImplement the myAtoi(string s) function, which converts a string to ...
palindrome-number
palindrome-number__01__javascript
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven an integer x, return true if x is a palindrome, and false othe...
regular-expression-matching
regular-expression-matching__01__javascript
Memoization
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven an input string s and a pattern p, implement regular expressio...
regular-expression-matching
regular-expression-matching__02__javascript
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven an input string s and a pattern p, implement regular expressio...
container-with-most-water
container-with-most-water__01__javascript
Two Pointers
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array height of length n. There are n verti...
roman-to-integer
roman-to-integer__01__javascript
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nRoman numerals are represented by seven different symbols: I, V, X, ...
longest-common-prefix
longest-common-prefix__01__javascript
Trie
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nWrite a function to find the longest common prefix string amongst an...
3sum
3sum__01__javascript
Two Pointers
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums, return all the triplets [nums[i], nums[...
3sum-closest
3sum-closest__01__javascript
Two Pointers
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums of length n and an integer target, find ...
letter-combinations-of-a-phone-number
letter-combinations-of-a-phone-number__01__javascript
Backtracking
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven a string containing digits from 2-9 inclusive, return all poss...
letter-combinations-of-a-phone-number
letter-combinations-of-a-phone-number__02__javascript
DFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven a string containing digits from 2-9 inclusive, return all poss...
4sum
4sum__01__javascript
Sorting
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven an array nums of n integers, return an array of all the unique...
remove-nth-node-from-end-of-list
remove-nth-node-from-end-of-list__01__javascript
Two Pointers
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven the head of a linked list, remove the nth node from the end of...
valid-parentheses
valid-parentheses__01__javascript
String
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven a string s containing just the characters '(', ')', '{', '}', ...
merge-two-sorted-lists
merge-two-sorted-lists__01__javascript
Recursion
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nYou are given the heads of two sorted linked lists list1 and list2.\...
merge-two-sorted-lists
merge-two-sorted-lists__02__javascript
Linked List
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nYou are given the heads of two sorted linked lists list1 and list2.\...
generate-parentheses
generate-parentheses__01__javascript
DFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven n pairs of parentheses, write a function to generate all combi...
merge-k-sorted-lists
merge-k-sorted-lists__01__javascript
Heap
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nYou are given an array of k linked-lists lists, each linked-list is ...
swap-nodes-in-pairs
swap-nodes-in-pairs__01__javascript
Recursion
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven a linked list, swap every two adjacent nodes and return its he...
swap-nodes-in-pairs
swap-nodes-in-pairs__02__javascript
Linked List
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven a linked list, swap every two adjacent nodes and return its he...
remove-duplicates-from-sorted-array
remove-duplicates-from-sorted-array__01__javascript
Two Pointers
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums sorted in non-decreasing order, remove t...
remove-element
remove-element__01__javascript
Two Pointers
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums and an integer val, remove all occurrenc...
find-the-index-of-the-first-occurrence-in-a-string
find-the-index-of-the-first-occurrence-in-a-string__01__javascript
Two Pointers
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven two strings needle and haystack, return the index of the first...
next-permutation
next-permutation__01__javascript
Two Pointers
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nA permutation of an array of integers is an arrangement of its membe...
longest-valid-parentheses
longest-valid-parentheses__01__javascript
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven a string containing just the characters '(' and ')', return th...
longest-valid-parentheses
longest-valid-parentheses__02__javascript
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven a string containing just the characters '(' and ')', return th...
search-in-rotated-sorted-array
search-in-rotated-sorted-array__01__javascript
Binary Search
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nThere is an integer array nums sorted in ascending order (with disti...
find-first-and-last-position-of-element-in-sorted-array
find-first-and-last-position-of-element-in-sorted-array__01__javascript
Binary Search
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven an array of integers nums sorted in non-decreasing order, find...
search-insert-position
search-insert-position__01__javascript
Binary Search
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven a sorted array of distinct integers and a target value, return...
valid-sudoku
valid-sudoku__01__javascript
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nDetermine if a 9 x 9 Sudoku board is valid. Only the filled cells ne...
count-and-say
count-and-say__01__javascript
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nThe count-and-say sequence is a sequence of digit strings defined by...
combination-sum-ii
combination-sum-ii__01__javascript
Backtracking
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven a collection of candidate numbers (candidates) and a target nu...
combination-sum-ii
combination-sum-ii__02__javascript
Backtracking
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven a collection of candidate numbers (candidates) and a target nu...
multiply-strings
multiply-strings__01__javascript
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven two non-negative integers num1 and num2 represented as strings...
permutations
permutations__01__javascript
Backtracking
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven an array nums of distinct integers, return all the possible pe...
permutations-ii
permutations-ii__01__javascript
Backtracking
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven a collection of numbers, nums, that might contain duplicates, ...
rotate-image
rotate-image__01__javascript
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nYou are given an n x n 2D matrix representing an image, rotate the i...
powx-n
powx-n__01__javascript
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nImplement pow(x, n), which calculates x raised to the power n (i.e.,...
n-queens-ii
n-queens-ii__01__javascript
Backtracking
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nThe n-queens puzzle is the problem of placing n queens on an n x n c...
maximum-subarray
maximum-subarray__01__javascript
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums, find the subarray with the largest sum,...
spiral-matrix
spiral-matrix__01__javascript
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven an m x n matrix, return all elements of the matrix in spiral o...
spiral-matrix
spiral-matrix__02__javascript
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven an m x n matrix, return all elements of the matrix in spiral o...
jump-game
jump-game__01__javascript
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums. You are initially positioned at...
length-of-last-word
length-of-last-word__01__javascript
Two Pointers
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven a string s consisting of words and spaces, return the length o...
spiral-matrix-ii
spiral-matrix-ii__01__javascript
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven a positive integer n, generate an n x n matrix filled with ele...
unique-paths
unique-paths__01__javascript
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nThere is a robot on an m x n grid. The robot is initially located at...
unique-paths
unique-paths__02__javascript
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nThere is a robot on an m x n grid. The robot is initially located at...
unique-paths
unique-paths__03__javascript
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nThere is a robot on an m x n grid. The robot is initially located at...
unique-paths-ii
unique-paths-ii__01__javascript
Memoization
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nYou are given an m x n integer array grid. There is a robot initiall...
unique-paths-ii
unique-paths-ii__02__javascript
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nYou are given an m x n integer array grid. There is a robot initiall...
minimum-path-sum
minimum-path-sum__01__javascript
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven a m x n grid filled with non-negative numbers, find a path fro...
plus-one
plus-one__01__javascript
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nYou are given a large integer represented as an integer array digits...
sqrtx
sqrtx__01__javascript
Binary Search
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven a non-negative integer x, return the square root of x rounded ...
climbing-stairs
climbing-stairs__01__javascript
Recursion
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nYou are climbing a staircase. It takes n steps to reach the top.\n\n...
climbing-stairs
climbing-stairs__02__javascript
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nYou are climbing a staircase. It takes n steps to reach the top.\n\n...
edit-distance
edit-distance__01__javascript
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven two strings word1 and word2, return the minimum number of oper...
set-matrix-zeroes
set-matrix-zeroes__01__javascript
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven an m x n integer matrix matrix, if an element is 0, set its en...
set-matrix-zeroes
set-matrix-zeroes__02__javascript
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven an m x n integer matrix matrix, if an element is 0, set its en...
search-a-2d-matrix
search-a-2d-matrix__01__javascript
Binary Search
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nYou are given an m x n integer matrix matrix with the following two ...
search-a-2d-matrix
search-a-2d-matrix__02__javascript
Binary Search
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nYou are given an m x n integer matrix matrix with the following two ...
word-search
word-search__01__javascript
Backtracking
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven an m x n grid of characters board and a string word, return tr...
remove-duplicates-from-sorted-array-ii
remove-duplicates-from-sorted-array-ii__01__javascript
Two Pointers
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums sorted in non-decreasing order, remove s...
search-in-rotated-sorted-array-ii
search-in-rotated-sorted-array-ii__01__javascript
Binary Search
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nThere is an integer array nums sorted in non-decreasing order (not n...
remove-duplicates-from-sorted-list-ii
remove-duplicates-from-sorted-list-ii__01__javascript
Two Pointers
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven the head of a sorted linked list, delete all nodes that have d...
remove-duplicates-from-sorted-list
remove-duplicates-from-sorted-list__01__javascript
Linked List
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven the head of a sorted linked list, delete all duplicates such t...
partition-list
partition-list__01__javascript
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven the head of a linked list and a value x, partition it such tha...
merge-sorted-array
merge-sorted-array__01__javascript
Two Pointers
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nYou are given two integer arrays nums1 and nums2, sorted in non-decr...
gray-code
gray-code__01__javascript
Backtracking
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nAn n-bit gray code sequence is a sequence of 2n integers where:\n\n\...
subsets-ii
subsets-ii__01__javascript
DFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums that may contain duplicates, return all ...
subsets-ii
subsets-ii__02__javascript
Sorting
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums that may contain duplicates, return all ...
reverse-linked-list-ii
reverse-linked-list-ii__01__javascript
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven the head of a singly linked list and two integers left and rig...
binary-tree-inorder-traversal
binary-tree-inorder-traversal__01__javascript
Recursion
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven the root of a binary tree, return the inorder traversal of its...
binary-tree-inorder-traversal
binary-tree-inorder-traversal__02__javascript
Recursion
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven the root of a binary tree, return the inorder traversal of its...
binary-tree-inorder-traversal
binary-tree-inorder-traversal__03__javascript
DFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven the root of a binary tree, return the inorder traversal of its...
validate-binary-search-tree
validate-binary-search-tree__01__javascript
Recursion
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven the root of a binary tree, determine if it is a valid binary s...
recover-binary-search-tree
recover-binary-search-tree__01__javascript
DFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nYou are given the root of a binary search tree (BST), where the valu...
same-tree
same-tree__01__javascript
DFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven the roots of two binary trees p and q, write a function to che...
symmetric-tree
symmetric-tree__01__javascript
Recursion
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven the root of a binary tree, check whether it is a mirror of its...
binary-tree-level-order-traversal
binary-tree-level-order-traversal__01__javascript
BFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven the root of a binary tree, return the level order traversal of...
binary-tree-zigzag-level-order-traversal
binary-tree-zigzag-level-order-traversal__01__javascript
BFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven the root of a binary tree, return the zigzag level order trave...
maximum-depth-of-binary-tree
maximum-depth-of-binary-tree__01__javascript
Recursion
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven the root of a binary tree, return its maximum depth.\n\nA bina...
construct-binary-tree-from-preorder-and-inorder-traversal
construct-binary-tree-from-preorder-and-inorder-traversal__01__javascript
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven two integer arrays preorder and inorder where preorder is the ...
binary-tree-level-order-traversal-ii
binary-tree-level-order-traversal-ii__01__javascript
BFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven the root of a binary tree, return the bottom-up level order tr...
convert-sorted-array-to-binary-search-tree
convert-sorted-array-to-binary-search-tree__01__javascript
Binary Search
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums where the elements are sorted in ascendi...
convert-sorted-list-to-binary-search-tree
convert-sorted-list-to-binary-search-tree__01__javascript
DFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven the head of a singly linked list where elements are sorted in ...
balanced-binary-tree
balanced-binary-tree__01__javascript
Recursion
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven a binary tree, determine if it is height-balanced.\n\n### Exam...
minimum-depth-of-binary-tree
minimum-depth-of-binary-tree__01__javascript
Recursion
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven a binary tree, find its minimum depth.\n\nThe minimum depth is...
minimum-depth-of-binary-tree
minimum-depth-of-binary-tree__02__javascript
BFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven a binary tree, find its minimum depth.\n\nThe minimum depth is...
path-sum
path-sum__01__javascript
Recursion
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven the root of a binary tree and an integer targetSum, return tru...
path-sum-ii
path-sum-ii__01__javascript
DFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven the root of a binary tree and an integer targetSum, return all...
flatten-binary-tree-to-linked-list
flatten-binary-tree-to-linked-list__01__javascript
DFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven the root of a binary tree, flatten the tree into a \"linked li...
pascals-triangle
pascals-triangle__01__javascript
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven an integer numRows, return the first numRows of Pascal's trian...
pascals-triangle-ii
pascals-triangle-ii__01__javascript
Recursion
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution." }, { "role": "user", "content": "### Problem\nGiven an integer rowIndex, return the rowIndexth (0-indexed) row of ...
End of preview. Expand in Data Studio

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, Java, C++, and 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, 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, 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

{
  "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
Downloads last month
-

Collection including AmareshHebbar/leetcode-codegen-javascript