slug
stringlengths
4
75
solution_id
stringlengths
20
91
primary_algorithm
stringclasses
22 values
verified
null
messages
listlengths
3
3
best-time-to-buy-and-sell-stock
best-time-to-buy-and-sell-stock__01__javascript
Brute Force
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 prices where prices[i] is the price of a give...
best-time-to-buy-and-sell-stock-ii
best-time-to-buy-and-sell-stock-ii__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 prices where prices[i] is the price o...
binary-tree-maximum-path-sum
binary-tree-maximum-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\nA path in a binary tree is a sequence of nodes where each pair of ad...
valid-palindrome
valid-palindrome__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 phrase is a palindrome if, after converting all uppercase letters ...
longest-consecutive-sequence
longest-consecutive-sequence__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 unsorted array of integers nums, return the length of the l...
longest-consecutive-sequence
longest-consecutive-sequence__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 unsorted array of integers nums, return the length of the l...
sum-root-to-leaf-numbers
sum-root-to-leaf-numbers__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 tree containing digits from 0 to ...
clone-graph
clone-graph__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 a reference of a node in a connected undirected graph.\n\nRetu...
single-number
single-number__01__javascript
Bit Manipulation
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-empty array of integers nums, every element appears twic...
single-number-ii
single-number-ii__01__javascript
Bit Manipulation
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 every element appears three times ...
single-number-ii
single-number-ii__02__javascript
Bit Manipulation
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 every element appears three times ...
single-number-ii
single-number-ii__03__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 array nums where every element appears three times ...
copy-list-with-random-pointer
copy-list-with-random-pointer__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\nA linked list of length n is given such that each node contains an a...
copy-list-with-random-pointer
copy-list-with-random-pointer__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\nA linked list of length n is given such that each node contains an a...
linked-list-cycle
linked-list-cycle__02__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 head, the head of a linked list, determine if the linked list ...
linked-list-cycle-ii
linked-list-cycle-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 linked list, return the node where the cycle beg...
reorder-list
reorder-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\nYou are given the head of a singly linked-list. The list can be repr...
lru-cache
lru-cache__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\nDesign a data structure that follows the constraints of a Least Rece...
insertion-sort-list
insertion-sort-list__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 the head of a singly linked list, sort the list using insertio...
sort-list
sort-list__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 the head of a linked list, return the list after sorting it in...
maximum-product-subarray
maximum-product-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 a subarray that has the largest pr...
find-minimum-in-rotated-sorted-array
find-minimum-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\nSuppose an array of length n sorted in ascending order is rotated be...
find-minimum-in-rotated-sorted-array-ii
find-minimum-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\nSuppose an array of length n sorted in ascending order is rotated be...
min-stack
min-stack__01__javascript
Brute Force
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\nDesign a stack that supports push, pop, top, and retrieving the mini...
intersection-of-two-linked-lists
intersection-of-two-linked-lists__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 heads of two singly linked-lists headA and headB, return t...
two-sum-ii-input-array-is-sorted
two-sum-ii-input-array-is-sorted__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 1-indexed array of integers numbers that is already sorted i...
two-sum-ii-input-array-is-sorted
two-sum-ii-input-array-is-sorted__02__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 1-indexed array of integers numbers that is already sorted i...
majority-element
majority-element__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 an array nums of size n, return the majority element.\n\nThe m...
binary-search-tree-iterator
binary-search-tree-iterator__01__javascript
Brute Force
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 BSTIterator class that represents an iterator over the...
largest-number
largest-number__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\nGiven a list of non-negative integers nums, arrange them such that t...
repeated-dna-sequences
repeated-dna-sequences__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\nThe DNA sequence is composed of a series of nucleotides abbreviated ...
rotate-array
rotate-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, rotate the array to the right by k step...
reverse-bits
reverse-bits__01__javascript
Bit Manipulation
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\nReverse bits of a given 32 bits signed integer.\n\n### Examples\nInp...
number-of-1-bits
number-of-1-bits__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 a positive integer n, write a function that returns the number...
number-of-1-bits
number-of-1-bits__02__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 a positive integer n, write a function that returns the number...
house-robber
house-robber__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 a professional robber planning to rob houses along a street....
house-robber
house-robber__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 a professional robber planning to rob houses along a street....
house-robber
house-robber__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\nYou are a professional robber planning to rob houses along a street....
binary-tree-right-side-view
binary-tree-right-side-view__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, imagine yourself standing on the ri...
binary-tree-right-side-view
binary-tree-right-side-view__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 the root of a binary tree, imagine yourself standing on the ri...
bitwise-and-of-numbers-range
bitwise-and-of-numbers-range__01__javascript
Bit Manipulation
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 integers left and right that represent the range [left, ri...
count-primes
count-primes__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 n, return the number of prime numbers that are stri...
reverse-linked-list
reverse-linked-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 singly linked list, reverse the list, and return...
combination-sum-iii
combination-sum-iii__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\nFind all valid combinations of k numbers that sum up to n such that ...
combination-sum-iii
combination-sum-iii__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\nFind all valid combinations of k numbers that sum up to n such that ...
contains-duplicate
contains-duplicate__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 integer array nums, return true if any value appears at lea...
contains-duplicate-ii
contains-duplicate-ii__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 integer array nums and an integer k, return true if there a...
count-complete-tree-nodes
count-complete-tree-nodes__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 complete binary tree, return the number of the n...
count-complete-tree-nodes
count-complete-tree-nodes__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\nGiven the root of a complete binary tree, return the number of the n...
invert-binary-tree
invert-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, invert the tree, and return its roo...
power-of-two
power-of-two__01__javascript
Bit Manipulation
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 n, return true if it is a power of two. Otherwise, ...
power-of-two
power-of-two__02__javascript
Bit Manipulation
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 n, return true if it is a power of two. Otherwise, ...
palindrome-linked-list
palindrome-linked-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 singly linked list, return true if it is a palin...
lowest-common-ancestor-of-a-binary-tree
lowest-common-ancestor-of-a-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 the lowest common ancestor (LCA) of two gi...
delete-node-in-a-linked-list
delete-node-in-a-linked-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\nThere is a singly-linked list head and we want to delete a node node...
product-of-array-except-self
product-of-array-except-self__01__javascript
Array
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 an array answer such that answer...
sliding-window-maximum
sliding-window-maximum__02__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\nYou are given an array of integers nums, there is a sliding window o...
search-a-2d-matrix-ii
search-a-2d-matrix-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\nWrite an efficient algorithm that searches for a value target in an ...
valid-anagram
valid-anagram__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 two strings s and t, return true if t is an anagram of s, and ...
count-univalue-subtrees
count-univalue-subtrees__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, return the number of uni-value subt...
paint-house
paint-house__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 row of n houses, where each house can be painted one of t...
3sum-smaller
3sum-smaller__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 array of n integers nums and an integer target, find the nu...
single-number-iii
single-number-iii__01__javascript
Bit Manipulation
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, in which exactly two elements appear on...
single-number-iii
single-number-iii__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 integer array nums, in which exactly two elements appear on...
graph-valid-tree
graph-valid-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 have a graph of n nodes labeled from 0 to n - 1. You are given a...
graph-valid-tree
graph-valid-tree__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\nYou have a graph of n nodes labeled from 0 to n - 1. You are given a...
ugly-number
ugly-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\nAn ugly number is a positive integer which does not have a prime fac...
ugly-number-ii
ugly-number-ii__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\nAn ugly number is a positive integer whose prime factors are limited...
palindrome-permutation
palindrome-permutation__01__javascript
Bit Manipulation
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 true if a permutation of the string could f...
missing-number
missing-number__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 nums containing n distinct numbers in the range [0, n...
missing-number
missing-number__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 array nums containing n distinct numbers in the range [0, n...
closest-binary-search-tree-value
closest-binary-search-tree-value__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 search tree and a target value, return th...
closest-binary-search-tree-value
closest-binary-search-tree-value__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\nGiven the root of a binary search tree and a target value, return th...
integer-to-english-words
integer-to-english-words__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\nConvert a non-negative integer num to its English words representati...
first-bad-version
first-bad-version__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 a product manager and currently leading a team to develop a ...
move-zeroes
move-zeroes__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, move all 0's to the end of it while mai...
inorder-successor-in-bst
inorder-successor-in-bst__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 the root of a binary search tree and a node p in it, return th...
find-the-duplicate-number
find-the-duplicate-number__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 containing n + 1 integers where each...
find-median-from-data-stream
find-median-from-data-stream__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\nThe median is the middle value in an ordered integer list. If the si...
serialize-and-deserialize-binary-tree
serialize-and-deserialize-binary-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\nSerialization is the process of converting a data structure or objec...
range-sum-query-immutable
range-sum-query-immutable__01__javascript
Array
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, handle multiple queries of the followin...
range-sum-query-2d-immutable
range-sum-query-2d-immutable__01__javascript
Array
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 2D matrix matrix, handle multiple queries of the following t...
coin-change
coin-change__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\nYou are given an integer array coins representing coins of different...
number-of-connected-components-in-an-undirected-graph
number-of-connected-components-in-an-undirected-graph__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 have a graph of n nodes. You are given an integer n and an array...
wiggle-sort-ii
wiggle-sort-ii__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\nGiven an integer array nums, reorder it such that nums[0] < nums[1] ...
maximum-size-subarray-sum-equals-k
maximum-size-subarray-sum-equals-k__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 integer array nums and an integer k, return the maximum len...
power-of-three
power-of-three__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 n, return true if it is a power of three. Otherwise...
power-of-three
power-of-three__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 integer n, return true if it is a power of three. Otherwise...
nested-list-weight-sum
nested-list-weight-sum__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 a nested list of integers nestedList. Each element is ...
power-of-four
power-of-four__01__javascript
Bit Manipulation
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 n, return true if it is a power of four. Otherwise,...
integer-break
integer-break__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 n, break it into the sum of k positive integers, wh...
integer-break
integer-break__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 integer n, break it into the sum of k positive integers, wh...
reverse-string
reverse-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\nWrite a function that reverses a string. The input string is given a...
intersection-of-two-arrays
intersection-of-two-arrays__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 nums1 and nums2, return an array of their i...
intersection-of-two-arrays-ii
intersection-of-two-arrays-ii__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 nums1 and nums2, return an array of their i...
logger-rate-limiter
logger-rate-limiter__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\nDesign a logger system that receives a stream of messages along with...
sort-transformed-array
sort-transformed-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 a sorted integer array nums and three integers a, b and c, app...
nested-list-weight-sum-ii
nested-list-weight-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\nYou are given a nested list of integers nestedList. Each element is ...
range-addition
range-addition__01__javascript
Array
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 length and an array updates where updates[i...
range-addition
range-addition__02__javascript
Array
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 length and an array updates where updates[i...