slug
stringlengths
4
75
solution_id
stringlengths
20
91
primary_algorithm
stringclasses
22 values
verified
null
messages
listlengths
3
3
number-of-good-pairs
number-of-good-pairs__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 of integers nums, return the number of good pairs.\n\...
water-bottles
water-bottles__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\nThere are numBottles water bottles that are initially full of water....
shuffle-string
shuffle-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 and an integer array indices of the same le...
number-of-good-leaf-nodes-pairs
number-of-good-leaf-nodes-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\nYou are given the root of a binary tree and an integer distance. A p...
find-kth-bit-in-nth-binary-string
find-kth-bit-in-nth-binary-string__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 two positive integers n and k, the binary string Sn is formed ...
magnetic-force-between-two-balls
magnetic-force-between-two-balls__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\nIn the universe Earth C-137, Rick discovered a special form of magne...
detect-cycles-in-2d-grid
detect-cycles-in-2d-grid__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 a 2D array of characters grid of size m x n, you need to find ...
find-latest-group-of-size-m
find-latest-group-of-size-m__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 arr that represents a permutation of numbers from 1 t...
minimum-number-of-days-to-disconnect-island
minimum-number-of-days-to-disconnect-island__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 an m x n binary grid grid where 1 represents land and ...
shortest-subarray-to-be-removed-to-make-array-sorted
shortest-subarray-to-be-removed-to-make-array-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 an integer array arr, remove a subarray (can be empty) from ar...
make-sum-divisible-by-p
make-sum-divisible-by-p__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 positive integers nums, remove the smallest subarr...
crawler-log-folder
crawler-log-folder__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\nThe Leetcode file system keeps a log each time some user performs a ...
maximum-number-of-achievable-transfer-requests
maximum-number-of-achievable-transfer-requests__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\nWe have n buildings numbered from 0 to n - 1. Each building has a nu...
find-nearest-right-node-in-binary-tree
find-nearest-right-node-in-binary-tree__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 and a node u in the tree, return the...
find-nearest-right-node-in-binary-tree
find-nearest-right-node-in-binary-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\nGiven the root of a binary tree and a node u in the tree, return the...
find-valid-matrix-given-row-and-column-sums
find-valid-matrix-given-row-and-column-sums__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 arrays rowSum and colSum of non-negative integers ...
check-if-two-expression-trees-are-equivalent
check-if-two-expression-trees-are-equivalent__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 binary expression tree is a kind of binary tree used to represent ...
check-if-two-expression-trees-are-equivalent
check-if-two-expression-trees-are-equivalent__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\nA binary expression tree is a kind of binary tree used to represent ...
maximum-nesting-depth-of-the-parentheses
maximum-nesting-depth-of-the-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 valid parentheses string s, return the nesting depth of s. T...
maximum-font-to-fit-a-sentence-in-a-screen
maximum-font-to-fit-a-sentence-in-a-screen__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 a string text. We want to display text on a screen of ...
best-team-with-no-conflicts
best-team-with-no-conflicts__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 the manager of a basketball team. For the upcoming tournamen...
add-two-polynomials-represented-as-linked-lists
add-two-polynomials-represented-as-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\nA polynomial linked list is a special type of linked list where ever...
sort-array-by-increasing-frequency
sort-array-by-increasing-frequency__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 of integers nums, sort the array in increasing order ...
widest-vertical-area-between-two-points-containing-no-points
widest-vertical-area-between-two-points-containing-no-points__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 n points on a 2D plane where points[i] = [xi, yi], Return the ...
widest-vertical-area-between-two-points-containing-no-points
widest-vertical-area-between-two-points-containing-no-points__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 n points on a 2D plane where points[i] = [xi, yi], Return the ...
check-array-formation-through-concatenation
check-array-formation-through-concatenation__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 array of distinct integers arr and an array of inte...
lowest-common-ancestor-of-a-binary-tree-ii
lowest-common-ancestor-of-a-binary-tree-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, return the lowest common ancestor (...
minimum-deletions-to-make-string-balanced
minimum-deletions-to-make-string-balanced__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 a string s consisting only of characters 'a' and 'b'​​...
minimum-deletions-to-make-string-balanced
minimum-deletions-to-make-string-balanced__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 a string s consisting only of characters 'a' and 'b'​​...
correct-a-binary-tree
correct-a-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\nYou have a binary tree with a small defect. There is exactly one inv...
ways-to-make-a-fair-array
ways-to-make-a-fair-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\nYou are given an integer array nums. You can choose exactly one inde...
change-the-root-of-a-binary-tree
change-the-root-of-a-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 the root of a binary tree and a leaf node, reroot the tree so ...
design-front-middle-back-queue
design-front-middle-back-queue__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\nDesign a queue that supports push and pop operations in the front, m...
lowest-common-ancestor-of-a-binary-tree-iv
lowest-common-ancestor-of-a-binary-tree-iv__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 array of TreeNode objects nod...
concatenation-of-consecutive-binary-numbers
concatenation-of-consecutive-binary-numbers__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 the decimal value of the binary string fo...
concatenation-of-consecutive-binary-numbers
concatenation-of-consecutive-binary-numbers__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 the decimal value of the binary string fo...
sum-of-absolute-differences-in-a-sorted-array
sum-of-absolute-differences-in-a-sorted-array__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 sorted in non-decreasing order.\...
count-of-matches-in-tournament
count-of-matches-in-tournament__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 n, the number of teams in a tournament that...
maximum-height-by-stacking-cuboids
maximum-height-by-stacking-cuboids__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 n cuboids where the dimensions of the ith cuboid is cuboids[i]...
average-waiting-time
average-waiting-time__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\nThere is a restaurant with a single chef. You are given an array cus...
determine-if-string-halves-are-alike
determine-if-string-halves-are-alike__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 of even length. Split this string into two ...
where-will-the-ball-fall
where-will-the-ball-fall__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 2-D grid of size m x n representing a box, and you have n...
ways-to-split-array-into-three-subarrays
ways-to-split-array-into-three-subarrays__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\nA split of an integer array is good if:\n\n\tThe array is split into...
maximum-score-from-removing-substrings
maximum-score-from-removing-substrings__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 a string s and two integers x and y. You can perform t...
shortest-path-to-get-food
shortest-path-to-get-food__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 starving and you want to eat food as quickly as possible. Yo...
find-the-highest-altitude
find-the-highest-altitude__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 is a biker going on a road trip. The road trip consists of n +...
latest-time-by-replacing-hidden-digits
latest-time-by-replacing-hidden-digits__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 a string time in the form of hh:mm, where some of the...
maximum-number-of-balls-in-a-box
maximum-number-of-balls-in-a-box__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 working in a ball factory where you have n balls numbered fr...
minimum-limit-of-balls-in-a-bag
minimum-limit-of-balls-in-a-bag__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 integer array nums where the ith bag contains nums[...
buildings-with-an-ocean-view
buildings-with-an-ocean-view__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 buildings in a line. You are given an integer array heig...
minimum-number-of-operations-to-move-all-balls-to-each-box
minimum-number-of-operations-to-move-all-balls-to-each-box__03__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 have n boxes. You are given a binary string boxes of length n, w...
closest-dessert-cost
closest-dessert-cost__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 would like to make dessert and are preparing to buy the ingredie...
sum-of-beauty-of-all-substrings
sum-of-beauty-of-all-substrings__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 beauty of a string is the difference in frequencies between the ...
sum-of-beauty-of-all-substrings
sum-of-beauty-of-all-substrings__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\nThe beauty of a string is the difference in frequencies between the ...
check-if-binary-string-has-at-most-one-segment-of-ones
check-if-binary-string-has-at-most-one-segment-of-ones__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 binary string s ​​​​​without leading zeros, return true​​​ i...
find-center-of-star-graph
find-center-of-star-graph__01__javascript
Graph
null
[ { "role": "system", "content": "You 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 undirected star graph consisting of n nodes labeled from...
maximize-number-of-nice-divisors
maximize-number-of-nice-divisors__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 positive integer primeFactors. You are asked to cons...
minimum-path-cost-in-a-hidden-grid
minimum-path-cost-in-a-hidden-grid__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\nThis is an interactive problem.\n\nThere is a robot in a hidden grid...
determine-color-of-a-chessboard-square
determine-color-of-a-chessboard-square__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 coordinates, a string that represents the coordinates ...
sentence-similarity-iii
sentence-similarity-iii__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 strings sentence1 and sentence2, each representing...
count-nice-pairs-in-an-array
count-nice-pairs-in-an-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 array nums that consists of non-negative integers. ...
count-nice-pairs-in-an-array
count-nice-pairs-in-an-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 array nums that consists of non-negative integers. ...
truncate-sentence
truncate-sentence__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 sentence is a list of words that are separated by a single space w...
minimum-absolute-sum-difference
minimum-absolute-sum-difference__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 two positive integer arrays nums1 and nums2, both of l...
sign-of-the-product-of-an-array
sign-of-the-product-of-an-array__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 a function signFunc(x) that returns:\n\n\t1 if x is positi...
find-the-winner-of-the-circular-game
find-the-winner-of-the-circular-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\nThere are n friends that are playing a game. The friends are sitting...
find-the-winner-of-the-circular-game
find-the-winner-of-the-circular-game__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\nThere are n friends that are playing a game. The friends are sitting...
maximum-xor-for-each-query
maximum-xor-for-each-query__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 a sorted array nums of n non-negative integers and an ...
maximum-xor-for-each-query
maximum-xor-for-each-query__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\nYou are given a sorted array nums of n non-negative integers and an ...
maximum-ice-cream-bars
maximum-ice-cream-bars__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\nIt is a sweltering summer day, and a boy wants to buy some ice cream...
sum-of-digits-in-base-k
sum-of-digits-in-base-k__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 (in base 10) and a base k, return the sum of the ...
maximum-population-year
maximum-population-year__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 a 2D integer array logs where each logs[i] = [birthi, ...
maximum-distance-between-a-pair-of-values
maximum-distance-between-a-pair-of-values__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 two non-increasing 0-indexed integer arrays nums1​​​​​...
maximum-distance-between-a-pair-of-values
maximum-distance-between-a-pair-of-values__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\nYou are given two non-increasing 0-indexed integer arrays nums1​​​​​...
longest-word-with-all-prefixes
longest-word-with-all-prefixes__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\nGiven an array of strings words, find the longest string in words su...
sorting-the-sentence
sorting-the-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\nA sentence is a list of words that are separated by a single space w...
incremental-memory-leak
incremental-memory-leak__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 integers memory1 and memory2 representing the avai...
sum-of-all-subset-xor-totals
sum-of-all-subset-xor-totals__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 XOR total of an array is defined as the bitwise XOR of all its e...
sum-of-all-subset-xor-totals
sum-of-all-subset-xor-totals__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\nThe XOR total of an array is defined as the bitwise XOR of all its e...
minimum-number-of-swaps-to-make-the-binary-string-alternating
minimum-number-of-swaps-to-make-the-binary-string-alternating__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 binary string s, return the minimum number of character swap...
finding-pairs-with-a-certain-sum
finding-pairs-with-a-certain-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\nYou are given two integer arrays nums1 and nums2. You are tasked to ...
longer-contiguous-segments-of-ones-than-zeros
longer-contiguous-segments-of-ones-than-zeros__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 binary string s, return true if the longest contiguous segme...
minimum-speed-to-arrive-on-time
minimum-speed-to-arrive-on-time__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 a floating-point number hour, representing the amount ...
jump-game-vii
jump-game-vii__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 a 0-indexed binary string s and two integers minJump a...
minimize-maximum-pair-sum-in-array
minimize-maximum-pair-sum-in-array__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\nThe pair sum of a pair (a,b) is equal to a + b. The maximum pair sum...
check-if-word-equals-summation-of-two-words
check-if-word-equals-summation-of-two-words__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\nThe letter value of a letter is its position in the alphabet startin...
maximum-value-after-insertion
maximum-value-after-insertion__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 a very large integer n, represented as a string,​​​​​​...
count-pairs-in-two-arrays
count-pairs-in-two-arrays__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 integer arrays nums1 and nums2 of length n, count the pair...
reduction-operations-to-make-the-array-elements-equal
reduction-operations-to-make-the-array-elements-equal__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, your goal is to make all elements in nu...
minimum-number-of-flips-to-make-the-binary-string-alternating
minimum-number-of-flips-to-make-the-binary-string-alternating__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\nYou are given a binary string s. You are allowed to perform two type...
cutting-ribbons
cutting-ribbons__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 integer array ribbons, where ribbons[i] represents ...
check-if-all-the-integers-in-a-range-are-covered
check-if-all-the-integers-in-a-range-are-covered__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 a 2D integer array ranges and two integers left and ri...
maximum-number-of-removable-characters
maximum-number-of-removable-characters__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 two strings s and p where p is a subsequence of s. You...
largest-odd-number-in-string
largest-odd-number-in-string__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 a string num, representing a large integer. Return the...
count-sub-islands
count-sub-islands__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 two m x n binary matrices grid1 and grid2 containing o...
maximum-product-difference-between-two-pairs
maximum-product-difference-between-two-pairs__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\nThe product difference between two pairs (a, b) and (c, d) is define...
number-of-wonderful-substrings
number-of-wonderful-substrings__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\nA wonderful string is a string where at most one letter appears an o...
build-array-from-permutation
build-array-from-permutation__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 zero-based permutation nums (0-indexed), build an array ans ...
eliminate-maximum-number-of-monsters
eliminate-maximum-number-of-monsters__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 playing a video game where you are defending your city from ...
concatenation-of-array
concatenation-of-array__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 array nums of length n, you want to create an array...