slug
stringlengths
4
77
solution_id
stringlengths
16
89
primary_algorithm
stringclasses
22 values
verified
bool
1 class
messages
listlengths
3
3
count-collisions-on-a-road
count-collisions-on-a-road__01__python
String
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nThere are n cars on an infinitely long road. The cars are numbered from ...
maximum-points-in-an-archery-competition
maximum-points-in-an-archery-competition__01__python
Backtracking
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nAlice and Bob are opponents in an archery competition. The competition h...
minimum-health-to-beat-game
minimum-health-to-beat-game__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are playing a game that has n levels numbered from 0 to n - 1. You a...
minimum-deletions-to-make-array-beautiful
minimum-deletions-to-make-array-beautiful__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array nums. The array nums is beautifu...
minimum-deletions-to-make-array-beautiful
minimum-deletions-to-make-array-beautiful__02__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array nums. The array nums is beautifu...
find-palindrome-with-fixed-length
find-palindrome-with-fixed-length__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an integer array queries and a positive integer intLength, return ...
maximum-sum-score-of-array
maximum-sum-score-of-array__01__python
Array
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array nums of length n.\n\nThe sum sco...
minimum-bit-flips-to-convert-number
minimum-bit-flips-to-convert-number__01__python
Bit Manipulation
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nA bit flip of a number x is choosing a bit in the binary representation ...
find-triangular-sum-of-an-array
find-triangular-sum-of-an-array__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array nums, where nums[i] is a digit b...
number-of-ways-to-select-buildings
number-of-ways-to-select-buildings__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed binary string s which represents the types of ...
find-players-with-zero-or-one-losses
find-players-with-zero-or-one-losses__01__python
Sorting
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array matches where matches[i] = [winneri, lose...
maximum-candies-allocated-to-k-children
maximum-candies-allocated-to-k-children__01__python
Binary Search
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array candies. Each element in the arr...
check-if-an-array-is-consecutive
check-if-an-array-is-consecutive__01__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums, return true if nums is consecutive, otherwi...
largest-number-after-digit-swaps-by-parity
largest-number-after-digit-swaps-by-parity__01__python
Sorting
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a positive integer num. You may swap any two digits of num...
minimize-result-by-adding-parentheses-to-expression
minimize-result-by-adding-parentheses-to-expression__01__python
String
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed string expression of the form \"<num1>+<num2>\...
add-two-integers
add-two-integers__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven two integers num1 and num2, return the sum of the two integers.\n\...
add-two-integers
add-two-integers__02__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven two integers num1 and num2, return the sum of the two integers.\n\...
root-equals-sum-of-children
root-equals-sum-of-children__01__python
Brute Force
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given the root of a binary tree that consists of exactly 3 nodes...
find-closest-number-to-zero
find-closest-number-to-zero__01__python
Array
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums of size n, return the number with the value ...
number-of-ways-to-buy-pens-and-pencils
number-of-ways-to-buy-pens-and-pencils__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an integer total indicating the amount of money you have. ...
calculate-digit-sum-of-a-string
calculate-digit-sum-of-a-string__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a string s consisting of digits and an integer k.\n\nA rou...
minimum-rounds-to-complete-all-tasks
minimum-rounds-to-complete-all-tasks__01__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array tasks, where tasks[i] represents...
maximum-trailing-zeros-in-a-cornered-path
maximum-trailing-zeros-in-a-cornered-path__01__python
Brute Force
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 2D integer array grid of size m x n, where each cell con...
longest-path-with-different-adjacent-characters
longest-path-with-different-adjacent-characters__01__python
DFS
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a tree (i.e. a connected, undirected graph that has no cyc...
maximum-cost-of-trip-with-k-highways
maximum-cost-of-trip-with-k-highways__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nA series of highways connect n cities numbered from 0 to n - 1. You are ...
intersection-of-multiple-arrays
intersection-of-multiple-arrays__01__python
Sorting
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a 2D integer array nums where nums[i] is a non-empty array of dist...
intersection-of-multiple-arrays
intersection-of-multiple-arrays__02__python
Sorting
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a 2D integer array nums where nums[i] is a non-empty array of dist...
count-lattice-points-inside-a-circle
count-lattice-points-inside-a-circle__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a 2D integer array circles where circles[i] = [xi, yi, ri] represe...
minimum-average-difference
minimum-average-difference__01__python
Array
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array nums of length n.\n\nThe average...
remove-digit-from-number-to-maximize-result
remove-digit-from-number-to-maximize-result__01__python
Brute Force
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a string number representing a positive integer and a char...
remove-digit-from-number-to-maximize-result
remove-digit-from-number-to-maximize-result__02__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a string number representing a positive integer and a char...
minimum-consecutive-cards-to-pick-up
minimum-consecutive-cards-to-pick-up__01__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array cards where cards[i] represents the value...
k-divisible-elements-subarrays
k-divisible-elements-subarrays__01__python
Trie
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums and two integers k and p, return the number ...
k-divisible-elements-subarrays
k-divisible-elements-subarrays__02__python
Trie
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums and two integers k and p, return the number ...
total-appeal-of-a-string
total-appeal-of-a-string__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nThe appeal of a string is the number of distinct characters found in the...
make-array-non-decreasing-or-non-increasing
make-array-non-decreasing-or-non-increasing__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array nums. In one operation, you can:...
largest-3-same-digit-number-in-string
largest-3-same-digit-number-in-string__01__python
String
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a string num representing a large integer. An integer is g...
count-nodes-equal-to-average-of-subtree
count-nodes-equal-to-average-of-subtree__01__python
DFS
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven the root of a binary tree, return the number of nodes where the va...
minimum-number-of-keypresses
minimum-number-of-keypresses__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou have a keypad with 9 buttons, numbered from 1 to 9, each mapped to l...
find-the-k-beauty-of-a-number
find-the-k-beauty-of-a-number__01__python
Sliding Window
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nThe k-beauty of an integer num is defined as the number of substrings of...
find-the-k-beauty-of-a-number
find-the-k-beauty-of-a-number__02__python
Sliding Window
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nThe k-beauty of an integer num is defined as the number of substrings of...
number-of-ways-to-split-array
number-of-ways-to-split-array__01__python
Array
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array nums of length n.\n\nnums contai...
maximum-white-tiles-covered-by-a-carpet
maximum-white-tiles-covered-by-a-carpet__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 2D integer array tiles where tiles[i] = [li, ri] represe...
largest-combination-with-bitwise-and-greater-than-zero
largest-combination-with-bitwise-and-greater-than-zero__01__python
Bit Manipulation
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nThe bitwise AND of an array nums is the bitwise AND of all integers in n...
percentage-of-letter-in-string
percentage-of-letter-in-string__01__python
String
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a string s and a character letter, return the percentage of charac...
maximum-bags-with-full-capacity-of-rocks
maximum-bags-with-full-capacity-of-rocks__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou have n bags numbered from 0 to n - 1. You are given two 0-indexed in...
number-of-people-that-can-be-seen-in-a-grid
number-of-people-that-can-be-seen-in-a-grid__01__python
Array
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an m x n 0-indexed 2D array of positive integers heights w...
check-if-number-has-equal-digit-count-and-digit-value
check-if-number-has-equal-digit-count-and-digit-value__01__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed string num of length n consisting of digits.\n...
sender-with-largest-word-count
sender-with-largest-word-count__01__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou have a chat log of n messages. You are given two string arrays messa...
maximum-total-importance-of-roads
maximum-total-importance-of-roads__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an integer n denoting the number of cities in a country. T...
rearrange-characters-to-make-target-string
rearrange-characters-to-make-target-string__01__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given two 0-indexed strings s and target. You can take some lett...
apply-discount-to-prices
apply-discount-to-prices__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nA sentence is a string of single-space separated words where each word c...
steps-to-make-array-non-decreasing
steps-to-make-array-non-decreasing__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array nums. In one step, remove all el...
maximum-profit-from-trading-stocks
maximum-profit-from-trading-stocks__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given two 0-indexed integer arrays of the same length present an...
maximum-profit-from-trading-stocks
maximum-profit-from-trading-stocks__02__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given two 0-indexed integer arrays of the same length present an...
min-max-game
min-max-game__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array nums whose length is a power of ...
partition-array-such-that-maximum-difference-is-k
partition-array-such-that-maximum-difference-is-k__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums and an integer k. You may partition ...
replace-elements-in-an-array
replace-elements-in-an-array__01__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed array nums that consists of n distinct positiv...
jump-game-viii
jump-game-viii__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array nums of length n. You are initia...
strong-password-checker-ii
strong-password-checker-ii__01__python
Bit Manipulation
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nA password is said to be strong if it satisfies all the following criter...
match-substring-after-replacement
match-substring-after-replacement__01__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given two strings s and sub. You are also given a 2D character a...
match-substring-after-replacement
match-substring-after-replacement__02__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given two strings s and sub. You are also given a 2D character a...
count-subarrays-with-score-less-than-k
count-subarrays-with-score-less-than-k__02__python
Two Pointers
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nThe score of an array is defined as the product of its sum and its lengt...
calculate-amount-paid-in-taxes
calculate-amount-paid-in-taxes__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed 2D integer array brackets where brackets[i] = ...
fair-distribution-of-cookies
fair-distribution-of-cookies__01__python
Backtracking
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array cookies, where cookies[i] denotes the num...
naming-a-company
naming-a-company__01__python
Bit Manipulation
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an array of strings ideas that represents a list of names ...
greatest-english-letter-in-upper-and-lower-case
greatest-english-letter-in-upper-and-lower-case__02__python
Bit Manipulation
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a string of English letters s, return the greatest English letter ...
sum-of-numbers-with-units-digit-k
sum-of-numbers-with-units-digit-k__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven two integers num and k, consider a set of positive integers with t...
sum-of-numbers-with-units-digit-k
sum-of-numbers-with-units-digit-k__02__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven two integers num and k, consider a set of positive integers with t...
sum-of-numbers-with-units-digit-k
sum-of-numbers-with-units-digit-k__03__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven two integers num and k, consider a set of positive integers with t...
longest-binary-subsequence-less-than-or-equal-to-k
longest-binary-subsequence-less-than-or-equal-to-k__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a binary string s and a positive integer k.\n\nReturn the ...
selling-pieces-of-wood
selling-pieces-of-wood__01__python
Memoization
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given two integers m and n that represent the height and width o...
selling-pieces-of-wood
selling-pieces-of-wood__02__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given two integers m and n that represent the height and width o...
minimum-flips-in-binary-tree-to-get-result
minimum-flips-in-binary-tree-to-get-result__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given the root of a binary tree with the following properties:\n...
count-asterisks
count-asterisks__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a string s, where every two consecutive vertical bars '|' ...
count-unreachable-pairs-of-nodes-in-an-undirected-graph
count-unreachable-pairs-of-nodes-in-an-undirected-graph__01__python
DFS
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an integer n. There is an undirected graph with n nodes, n...
check-if-matrix-is-x-matrix
check-if-matrix-is-x-matrix__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nA square matrix is said to be an X-Matrix if both of the following condi...
count-number-of-ways-to-place-houses
count-number-of-ways-to-place-houses__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nThere is a street with n * 2 plots, where there are n plots on each side...
maximum-score-of-spliced-array
maximum-score-of-spliced-array__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given two 0-indexed integer arrays nums1 and nums2, both of leng...
find-minimum-time-to-finish-all-jobs-ii
find-minimum-time-to-finish-all-jobs-ii__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given two 0-indexed integer arrays jobs and workers of equal len...
spiral-matrix-iv
spiral-matrix-iv__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given two integers m and n, which represent the dimensions of a ...
number-of-people-aware-of-a-secret
number-of-people-aware-of-a-secret__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nOn day 1, one person discovers a secret.\n\nYou are given an integer del...
valid-palindrome-iv
valid-palindrome-iv__01__python
Two Pointers
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed string s consisting of only lowercase English ...
the-latest-time-to-catch-a-bus
the-latest-time-to-catch-a-bus__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array buses of length n, where buses[i...
minimum-sum-of-squared-difference
minimum-sum-of-squared-difference__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given two positive 0-indexed integer arrays nums1 and nums2, bot...
subarray-with-elements-greater-than-varying-threshold
subarray-with-elements-greater-than-varying-threshold__01__python
Graph
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums and an integer threshold.\n\nFind an...
minimum-amount-of-time-to-fill-cups
minimum-amount-of-time-to-fill-cups__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou have a water dispenser that can dispense cold, warm, and hot water. ...
minimum-amount-of-time-to-fill-cups
minimum-amount-of-time-to-fill-cups__02__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou have a water dispenser that can dispense cold, warm, and hot water. ...
move-pieces-to-obtain-a-string
move-pieces-to-obtain-a-string__01__python
Two Pointers
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given two strings start and target, both of length n. Each strin...
move-pieces-to-obtain-a-string
move-pieces-to-obtain-a-string__02__python
Two Pointers
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given two strings start and target, both of length n. Each strin...
count-the-number-of-ideal-arrays
count-the-number-of-ideal-arrays__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given two integers n and maxValue, which are used to describe an...
count-the-number-of-ideal-arrays
count-the-number-of-ideal-arrays__02__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given two integers n and maxValue, which are used to describe an...
minimum-adjacent-swaps-to-make-a-valid-array
minimum-adjacent-swaps-to-make-a-valid-array__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array nums.\n\nSwaps of adjacent eleme...
maximum-number-of-pairs-in-array
maximum-number-of-pairs-in-array__01__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array nums. In one operation, you may ...
max-sum-of-a-pair-with-equal-sum-of-digits
max-sum-of-a-pair-with-equal-sum-of-digits__01__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed array nums consisting of positive integers. Yo...
query-kth-smallest-trimmed-number
query-kth-smallest-trimmed-number__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed array of strings nums, where each string is of...
finding-the-number-of-visible-mountains
finding-the-number-of-visible-mountains__01__python
Sorting
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed 2D integer array peaks where peaks[i] = [xi, y...
shortest-impossible-sequence-of-rolls
shortest-impossible-sequence-of-rolls__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array rolls of length n and an integer k. You r...
first-letter-to-appear-twice
first-letter-to-appear-twice__01__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a string s consisting of lowercase English letters, return the fir...
first-letter-to-appear-twice
first-letter-to-appear-twice__02__python
Bit Manipulation
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a string s consisting of lowercase English letters, return the fir...