slug
stringlengths
4
75
solution_id
stringlengths
20
91
primary_algorithm
stringclasses
22 values
verified
null
messages
listlengths
3
3
leaf-similar-trees
leaf-similar-trees__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\nConsider all the leaves of a binary tree, from left to right order, ...
length-of-longest-fibonacci-subsequence
length-of-longest-fibonacci-subsequence__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\nA sequence x1, x2, ..., xn is Fibonacci-like if:\n\n\tn >= 3\n\txi +...
walking-robot-simulation
walking-robot-simulation__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\nA robot on an infinite XY-plane starts at point (0, 0) facing north....
uncommon-words-from-two-sentences
uncommon-words-from-two-sentences__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 sentence is a string of single-space separated words where each wo...
spiral-matrix-iii
spiral-matrix-iii__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 start at the cell (rStart, cStart) of an rows x cols grid facing...
monotonic-array
monotonic-array__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\nAn array is monotonic if it is either monotone increasing or monoton...
sort-array-by-parity
sort-array-by-parity__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 the even integers at the begin...
sort-an-array
sort-an-array__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 of integers nums, sort the array in ascending order a...
sort-an-array
sort-an-array__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 an array of integers nums, sort the array in ascending order a...
word-subsets
word-subsets__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\nYou are given two string arrays words1 and words2.\n\nA string b is ...
complete-binary-tree-inserter
complete-binary-tree-inserter__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\nA complete binary tree is a binary tree in which every level, except...
minimum-add-to-make-parentheses-valid
minimum-add-to-make-parentheses-valid__03__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 parentheses string is valid if and only if:\n\n\tIt is the empty s...
sort-array-by-parity-ii
sort-array-by-parity-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 array of integers nums, half of the integers in nums are od...
flip-string-to-monotone-increasing
flip-string-to-monotone-increasing__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\nA binary string is monotone increasing if it consists of some number...
three-equal-parts
three-equal-parts__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 array arr which consists of only zeros and ones, di...
unique-email-addresses
unique-email-addresses__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\nEvery valid email consists of a local name and a domain name, separa...
binary-subarrays-with-sum
binary-subarrays-with-sum__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 binary array nums and an integer goal, return the number of ...
binary-subarrays-with-sum
binary-subarrays-with-sum__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\nGiven a binary array nums and an integer goal, return the number of ...
number-of-recent-calls
number-of-recent-calls__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 have a RecentCounter class which counts the number of recent req...
validate-stack-sequences
validate-stack-sequences__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 integer arrays pushed and popped each with distinct values...
most-stones-removed-with-same-row-or-column
most-stones-removed-with-same-row-or-column__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\nOn a 2D plane, we place n stones at some integer coordinate points. ...
flip-equivalent-binary-trees
flip-equivalent-binary-trees__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\nFor a binary tree T, we can define a flip operation as follows: choo...
regions-cut-by-slashes
regions-cut-by-slashes__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\nAn n x n grid is composed of 1 x 1 squares where each 1 x 1 square c...
regions-cut-by-slashes
regions-cut-by-slashes__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\nAn n x n grid is composed of 1 x 1 squares where each 1 x 1 square c...
n-repeated-element-in-size-2n-array
n-repeated-element-in-size-2n-array__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\nYou are given an integer array nums with the following properties:\n...
n-repeated-element-in-size-2n-array
n-repeated-element-in-size-2n-array__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 given an integer array nums with the following properties:\n...
maximum-width-ramp
maximum-width-ramp__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 ramp in an integer array nums is a pair (i, j) for which i < j and...
numbers-with-same-consecutive-differences
numbers-with-same-consecutive-differences__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 two integers n and k, return an array of all the integers of l...
powerful-integers
powerful-integers__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 three integers x, y, and bound, return a list of all the power...
squares-of-a-sorted-array
squares-of-a-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, return a...
unique-paths-iii
unique-paths-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\nYou are given an m x n integer array grid where grid[i][j] could be:...
sum-of-even-numbers-after-queries
sum-of-even-numbers-after-queries__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 integer array nums and an array queries where queri...
rotting-oranges
rotting-oranges__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\nYou are given an m x n grid where each cell can have one of three va...
next-greater-node-in-linked-list
next-greater-node-in-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\nYou are given the head of a linked list with n nodes.\n\nFor each no...
divisor-game
divisor-game__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\nAlice and Bob take turns playing a game, with Alice starting first.\...
maximum-difference-between-node-and-ancestor
maximum-difference-between-node-and-ancestor__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, find the maximum value v for which ...
recover-a-tree-from-preorder-traversal
recover-a-tree-from-preorder-traversal__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\nWe run a preorder depth-first search (DFS) on the root of a binary t...
uncrossed-lines
uncrossed-lines__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 two integer arrays nums1 and nums2. We write the integ...
binary-search-tree-to-greater-sum-tree
binary-search-tree-to-greater-sum-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 Search Tree (BST), convert it to a Greate...
last-stone-weight
last-stone-weight__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 integers stones where stones[i] is the wei...
remove-all-adjacent-duplicates-in-string
remove-all-adjacent-duplicates-in-string__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\nYou are given a string s consisting of lowercase English letters. A ...
last-stone-weight-ii
last-stone-weight-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\nYou are given an array of integers stones where stones[i] is the wei...
insufficient-nodes-in-root-to-leaf-paths
insufficient-nodes-in-root-to-leaf-paths__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 limit, delete all ins...
car-pooling
car-pooling__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\nThere is a car with capacity empty seats. The vehicle only drives ea...
corporate-flight-bookings
corporate-flight-bookings__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\nThere are n flights that are labeled from 1 to n.\n\nYou are given a...
delete-nodes-and-return-forest
delete-nodes-and-return-forest__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, each node in the tree has a distinc...
delete-nodes-and-return-forest
delete-nodes-and-return-forest__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 the root of a binary tree, each node in the tree has a distinc...
largest-unique-number
largest-unique-number__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 the largest integer that only oc...
armstrong-number
armstrong-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 n, return true if and only if it is an Armstrong nu...
n-th-tribonacci-number
n-th-tribonacci-number__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\nThe Tribonacci sequence Tn is defined as follows: \n\nT0 = 0, T1 = 1...
n-th-tribonacci-number
n-th-tribonacci-number__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\nThe Tribonacci sequence Tn is defined as follows: \n\nT0 = 0, T1 = 1...
longest-common-subsequence
longest-common-subsequence__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 text1 and text2, return the length of their longes...
binary-tree-coloring-game
binary-tree-coloring-game__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\nTwo players play a turn based game on a binary tree. We are given th...
day-of-the-year
day-of-the-year__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 string date representing a Gregorian calendar date formatted...
maximum-number-of-ones
maximum-number-of-ones__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\nConsider a matrix M with dimensions width * height, such that every ...
distance-between-bus-stops
distance-between-bus-stops__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\nA bus has n stops numbered from 0 to n - 1 that form a circle. We kn...
reverse-substrings-between-each-pair-of-parentheses
reverse-substrings-between-each-pair-of-parentheses__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 string s that consists of lower case English letters...
reverse-substrings-between-each-pair-of-parentheses
reverse-substrings-between-each-pair-of-parentheses__02__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\nYou are given a string s that consists of lower case English letters...
minimum-moves-to-reach-target-with-rotations
minimum-moves-to-reach-target-with-rotations__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\nIn an n*n grid, there is a snake that spans 2 cells and starts movin...
minimum-cost-to-move-chips-to-the-same-position
minimum-cost-to-move-chips-to-the-same-position__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\nWe have n chips, where the position of the ith chip is position[i].\...
longest-arithmetic-subsequence-of-given-difference
longest-arithmetic-subsequence-of-given-difference__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 arr and an integer difference, return the len...
path-with-maximum-gold
path-with-maximum-gold__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\nIn a gold mine grid of size m x n, each cell in this mine has an int...
count-vowels-permutation
count-vowels-permutation__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, your task is to count how many strings of length...
count-vowels-permutation
count-vowels-permutation__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 an integer n, your task is to count how many strings of length...
split-a-string-in-balanced-strings
split-a-string-in-balanced-strings__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\nBalanced strings are those that have an equal quantity of 'L' and 'R...
remove-sub-folders-from-the-filesystem
remove-sub-folders-from-the-filesystem__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 a list of folders folder, return the folders after removing al...
remove-sub-folders-from-the-filesystem
remove-sub-folders-from-the-filesystem__02__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\nGiven a list of folders folder, return the folders after removing al...
minimum-swaps-to-make-strings-equal
minimum-swaps-to-make-strings-equal__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 two strings s1 and s2 of equal length consisting of le...
find-elements-in-a-contaminated-binary-tree
find-elements-in-a-contaminated-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\nGiven a binary tree with the following rules:\n\n\troot.val == 0\n\t...
count-square-submatrices-with-all-ones
count-square-submatrices-with-all-ones__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 * n matrix of ones and zeros, return how many square subma...
find-the-smallest-divisor-given-a-threshold
find-the-smallest-divisor-given-a-threshold__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 and an integer threshold, we will ch...
element-appearing-more-than-25-in-sorted-array
element-appearing-more-than-25-in-sorted-array__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 sorted in non-decreasing order, there is exac...
remove-covered-intervals
remove-covered-intervals__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 intervals where intervals[i] = [li, ri] represent the...
convert-binary-number-in-a-linked-list-to-integer
convert-binary-number-in-a-linked-list-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\nGiven head which is a reference node to a singly-linked list. The va...
find-numbers-with-even-number-of-digits
find-numbers-with-even-number-of-digits__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 array nums of integers, return how many of them contain an ...
xor-queries-of-a-subarray
xor-queries-of-a-subarray__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\nYou are given an array arr of positive integers. You are also given ...
rank-transform-of-an-array
rank-transform-of-an-array__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 array of integers arr, replace each element with its rank.\...
find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance
find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-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\nThere are n cities numbered from 0 to n-1. Given the array edges whe...
find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance
find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance__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 are n cities numbered from 0 to n-1. Given the array edges whe...
minimum-number-of-steps-to-make-two-strings-anagram
minimum-number-of-steps-to-make-two-strings-anagram__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\nYou are given two strings of the same length s and t. In one step yo...
count-negative-numbers-in-a-sorted-matrix
count-negative-numbers-in-a-sorted-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\nGiven a m x n matrix grid which is sorted in non-increasing order bo...
product-of-the-last-k-numbers
product-of-the-last-k-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\nDesign an algorithm that accepts a stream of integers and retrieves ...
increasing-decreasing-string
increasing-decreasing-string__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 string s. Reorder the string using the following alg...
lucky-numbers-in-a-matrix
lucky-numbers-in-a-matrix__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 m x n matrix of distinct numbers, return all lucky numbers ...
count-number-of-teams
count-number-of-teams__03__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\nThere are n soldiers standing in a line. Each soldier is assigned a ...
the-k-th-lexicographical-string-of-all-happy-strings-of-length-n
the-k-th-lexicographical-string-of-all-happy-strings-of-length-n__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\nA happy string is a string that:\n\n\tconsists only of letters of th...
the-k-th-lexicographical-string-of-all-happy-strings-of-length-n
the-k-th-lexicographical-string-of-all-happy-strings-of-length-n__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 happy string is a string that:\n\n\tconsists only of letters of th...
maximum-points-you-can-obtain-from-cards
maximum-points-you-can-obtain-from-cards__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\nThere are several cards arranged in a row, and each card has an asso...
counting-elements
counting-elements__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 arr, count how many elements x there are, suc...
destination-city
destination-city__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\nYou are given the array paths, where paths[i] = [cityAi, cityBi] mea...
rearrange-words-in-a-sentence
rearrange-words-in-a-sentence__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 a sentence text (A sentence is a string of space-separated wor...
make-two-arrays-equal-by-reversing-subarrays
make-two-arrays-equal-by-reversing-subarrays__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\nYou are given two integer arrays of equal length target and arr. In ...
make-two-arrays-equal-by-reversing-subarrays
make-two-arrays-equal-by-reversing-subarrays__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\nYou are given two integer arrays of equal length target and arr. In ...
final-prices-with-a-special-discount-in-a-shop
final-prices-with-a-special-discount-in-a-shop__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 array prices where prices[i] is the price o...
check-if-array-pairs-are-divisible-by-k
check-if-array-pairs-are-divisible-by-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 array of integers arr of even length n and an integer k.\n\...
can-make-arithmetic-progression-from-sequence
can-make-arithmetic-progression-from-sequence__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\nA sequence of numbers is called an arithmetic progression if the dif...
can-make-arithmetic-progression-from-sequence
can-make-arithmetic-progression-from-sequence__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 sequence of numbers is called an arithmetic progression if the dif...
count-submatrices-with-all-ones
count-submatrices-with-all-ones__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 m x n binary matrix mat, return the number of submatrices t...
range-sum-of-sorted-subarray-sums
range-sum-of-sorted-subarray-sums__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 the array nums consisting of n positive integers. You ...
minimum-difference-between-largest-and-smallest-value-in-three-moves
minimum-difference-between-largest-and-smallest-value-in-three-moves__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.\n\nIn one move, you can choose ...