slug
stringlengths
4
77
solution_id
stringlengths
16
89
primary_algorithm
stringclasses
22 values
verified
bool
1 class
messages
listlengths
3
3
minimum-cost-homecoming-of-a-robot-in-a-grid
minimum-cost-homecoming-of-a-robot-in-a-grid__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\nThere is an m x n grid, where (0, 0) is the top-left cell and (m - 1, n ...
count-fertile-pyramids-in-a-land
count-fertile-pyramids-in-a-land__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 farmer has a rectangular grid of land with m rows and n columns that c...
find-target-indices-after-sorting-array
find-target-indices-after-sorting-array__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 nums and a target element target...
k-radius-subarray-averages
k-radius-subarray-averages__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\nYou are given a 0-indexed array nums of n integers, and an integer k.\n\...
removing-minimum-and-maximum-from-array
removing-minimum-and-maximum-from-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 array of distinct integers nums.\n\nThere is a...
finding-3-digit-even-numbers
finding-3-digit-even-numbers__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 digits, where each element is a digit. Th...
delete-the-middle-node-of-a-linked-list
delete-the-middle-node-of-a-linked-list__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 the head of a linked list. Delete the middle node, and ret...
step-by-step-directions-from-a-binary-tree-node-to-another
step-by-step-directions-from-a-binary-tree-node-to-another__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 the root of a binary tree with n nodes. Each node is uniqu...
step-by-step-directions-from-a-binary-tree-node-to-another
step-by-step-directions-from-a-binary-tree-node-to-another__02__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 the root of a binary tree with n nodes. Each node is uniqu...
subsequence-of-size-k-with-the-largest-even-sum
subsequence-of-size-k-with-the-largest-even-sum__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. Find the largest e...
find-good-days-to-rob-the-bank
find-good-days-to-rob-the-bank__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 and a gang of thieves are planning on robbing a bank. You are given ...
rings-and-rods
rings-and-rods__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\nThere are n rings and each ring is either red, green, or blue. The rings...
sum-of-subarray-ranges
sum-of-subarray-ranges__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 integer array nums. The range of a subarray of nums is ...
sum-of-subarray-ranges
sum-of-subarray-ranges__02__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 integer array nums. The range of a subarray of nums is ...
watering-plants-ii
watering-plants-ii__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\nAlice and Bob want to water n plants in their garden. The plants are arr...
maximum-fruits-harvested-after-at-most-k-steps
maximum-fruits-harvested-after-at-most-k-steps__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\nFruits are available at some positions on an infinite x-axis. You are gi...
number-of-unique-flavors-after-sharing-k-candies
number-of-unique-flavors-after-sharing-k-candies__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\nYou are given a 0-indexed integer array candies, where candies[i] repres...
find-first-palindromic-string-in-the-array
find-first-palindromic-string-in-the-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\nGiven an array of strings words, return the first palindromic string in ...
adding-spaces-to-a-string
adding-spaces-to-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 a 0-indexed string s and a 0-indexed integer array spaces ...
number-of-smooth-descent-periods-of-a-stock
number-of-smooth-descent-periods-of-a-stock__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 an integer array prices representing the daily price histo...
maximum-number-of-words-found-in-sentences
maximum-number-of-words-found-in-sentences__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\nA sentence is a list of words that are separated by a single space with ...
find-all-possible-recipes-from-given-supplies
find-all-possible-recipes-from-given-supplies__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 have information about n different recipes. You are given a string a...
abbreviating-the-product-of-a-range
abbreviating-the-product-of-a-range__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 positive integers left and right with left <= right. C...
a-number-after-a-double-reversal
a-number-after-a-double-reversal__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\nReversing an integer means to reverse all its digits.\n\n\tFor example, ...
execution-of-all-suffix-instructions-staying-in-a-grid
execution-of-all-suffix-instructions-staying-in-a-grid__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 is an n x n grid, with the top-left cell at (0, 0) and the bottom-...
intervals-between-identical-elements
intervals-between-identical-elements__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 of n integers arr.\n\nThe interval betwe...
recover-the-original-array
recover-the-original-array__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\nAlice had a 0-indexed array arr consisting of n positive integers. She c...
minimum-operations-to-remove-adjacent-ones-in-matrix
minimum-operations-to-remove-adjacent-ones-in-matrix__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 0-indexed binary matrix grid. In one operation, you can ...
check-if-all-as-appears-before-all-bs
check-if-all-as-appears-before-all-bs__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 consisting of only the characters 'a' and 'b', return t...
number-of-laser-beams-in-a-bank
number-of-laser-beams-in-a-bank__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\nAnti-theft security devices are activated inside a bank. You are given a...
destroying-asteroids
destroying-asteroids__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 mass, which represents the original mass of a p...
maximum-employees-to-be-invited-to-a-meeting
maximum-employees-to-be-invited-to-a-meeting__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 company is organizing a meeting and has a list of n employees, waiting...
remove-all-ones-with-row-and-column-flips
remove-all-ones-with-row-and-column-flips__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 m x n binary matrix grid.\n\nIn one operation, you can ...
capitalize-the-title
capitalize-the-title__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 title consisting of one or more words separated b...
maximum-twin-sum-of-a-linked-list
maximum-twin-sum-of-a-linked-list__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\nIn a linked list of size n, where n is even, the ith node (0-indexed) of...
maximum-twin-sum-of-a-linked-list
maximum-twin-sum-of-a-linked-list__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\nIn a linked list of size n, where n is even, the ith node (0-indexed) of...
longest-palindrome-by-concatenating-two-letter-words
longest-palindrome-by-concatenating-two-letter-words__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 array of strings words. Each element of words consists ...
stamping-the-grid
stamping-the-grid__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 m x n binary matrix grid where each cell is either 0 (e...
minimum-swaps-to-group-all-1s-together-ii
minimum-swaps-to-group-all-1s-together-ii__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\nA swap is defined as taking two distinct positions in an array and swapp...
count-words-obtained-after-adding-a-letter
count-words-obtained-after-adding-a-letter__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 two 0-indexed arrays of strings startWords and targetWords...
earliest-possible-day-of-full-bloom
earliest-possible-day-of-full-bloom__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 flower seeds. Every seed must be planted first before it can ...
divide-a-string-into-groups-of-size-k
divide-a-string-into-groups-of-size-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\nA string s can be partitioned into groups of size k using the following ...
minimum-moves-to-reach-target-score
minimum-moves-to-reach-target-score__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 with integers. You start with the integer 1 and y...
minimum-moves-to-reach-target-score
minimum-moves-to-reach-target-score__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 playing a game with integers. You start with the integer 1 and y...
solving-questions-with-brainpower
solving-questions-with-brainpower__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 a 0-indexed 2D integer array questions where questions[i] ...
solving-questions-with-brainpower
solving-questions-with-brainpower__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 a 0-indexed 2D integer array questions where questions[i] ...
maximum-running-time-of-n-computers
maximum-running-time-of-n-computers__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 have n computers. You are given the integer n and a 0-indexed intege...
choose-numbers-from-two-arrays-in-range
choose-numbers-from-two-arrays-in-range__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 of length n.\...
minimum-cost-of-buying-candies-with-discount
minimum-cost-of-buying-candies-with-discount__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\nA shop is selling candies at a discount. For every two candies sold, the...
count-the-hidden-sequences
count-the-hidden-sequences__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 array of n integers differences, which describ...
number-of-ways-to-divide-a-long-corridor
number-of-ways-to-divide-a-long-corridor__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\nAlong a long library corridor, there is a line of seats and decorative p...
number-of-ways-to-divide-a-long-corridor
number-of-ways-to-divide-a-long-corridor__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\nAlong a long library corridor, there is a line of seats and decorative p...
count-elements-with-strictly-smaller-and-greater-elements
count-elements-with-strictly-smaller-and-greater-elements__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 an integer array nums, return the number of elements that have bot...
rearrange-array-elements-by-sign
rearrange-array-elements-by-sign__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 integer array nums of even length consisting o...
find-all-lonely-numbers-in-the-array
find-all-lonely-numbers-in-the-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 an integer array nums. A number x is lonely when it appear...
maximum-good-people-based-on-statements
maximum-good-people-based-on-statements__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\nThere are two types of persons:\n\n\tThe good person: The person who alw...
minimum-number-of-lines-to-cover-points
minimum-number-of-lines-to-cover-points__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 an array points where points[i] = [xi, yi] represents a po...
keep-multiplying-found-values-by-two
keep-multiplying-found-values-by-two__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 array of integers nums. You are also given an integer o...
all-divisions-with-the-highest-score-of-a-binary-array
all-divisions-with-the-highest-score-of-a-binary-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 binary array nums of length n. nums can be div...
find-substring-with-given-hash-value
find-substring-with-given-hash-value__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 hash of a 0-indexed string s of length k, given integers p and m, is...
groups-of-strings
groups-of-strings__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 a 0-indexed array of strings words. Each string consists o...
amount-of-new-area-painted-each-day
amount-of-new-area-painted-each-day__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\nThere is a long and thin painting that can be represented by a number li...
minimum-sum-of-four-digit-number-after-splitting-digits
minimum-sum-of-four-digit-number-after-splitting-digits__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 positive integer num consisting of exactly four digits. ...
partition-array-according-to-given-pivot
partition-array-according-to-given-pivot__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 and an integer pivot. Rearr...
minimum-cost-to-set-cooking-time
minimum-cost-to-set-cooking-time__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 generic microwave supports cooking times for:\n\n\tat least 1 second.\...
sort-even-and-odd-indices-independently
sort-even-and-odd-indices-independently__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 integer array nums. Rearrange the values of nu...
smallest-value-of-the-rearranged-number
smallest-value-of-the-rearranged-number__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 num. Rearrange the digits of num such that its ...
minimum-time-to-remove-all-cars-containing-illegal-goods
minimum-time-to-remove-all-cars-containing-illegal-goods__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 a sequence of...
unique-substrings-with-equal-digit-frequency
unique-substrings-with-equal-digit-frequency__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 digit string s, return the number of unique substrings of s wher...
count-operations-to-obtain-zero
count-operations-to-obtain-zero__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 non-negative integers num1 and num2.\n\nIn one operati...
count-operations-to-obtain-zero
count-operations-to-obtain-zero__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\nYou are given two non-negative integers num1 and num2.\n\nIn one operati...
count-operations-to-obtain-zero
count-operations-to-obtain-zero__03__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 non-negative integers num1 and num2.\n\nIn one operati...
removing-minimum-number-of-magic-beans
removing-minimum-number-of-magic-beans__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 array of positive integers beans, where each integer re...
maximum-and-sum-of-array
maximum-and-sum-of-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 an integer array nums of length n and an integer numSlots ...
remove-all-ones-with-row-and-column-flips-ii
remove-all-ones-with-row-and-column-flips-ii__01__python
BFS
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 m x n binary matrix grid.\n\nIn one operation,...
count-equal-and-divisible-pairs-in-an-array
count-equal-and-divisible-pairs-in-an-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\nGiven a 0-indexed integer array nums of length n and an integer k, retur...
find-three-consecutive-integers-that-sum-to-a-given-number
find-three-consecutive-integers-that-sum-to-a-given-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\nGiven an integer num, return three consecutive integers (as a sorted arr...
count-good-triplets-in-an-array
count-good-triplets-in-an-array__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 two 0-indexed arrays nums1 and nums2 of length n, both of ...
count-good-triplets-in-an-array
count-good-triplets-in-an-array__02__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 two 0-indexed arrays nums1 and nums2 of length n, both of ...
count-integers-with-even-digit-sum
count-integers-with-even-digit-sum__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 positive integer num, return the number of positive integers les...
count-integers-with-even-digit-sum
count-integers-with-even-digit-sum__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 a positive integer num, return the number of positive integers les...
merge-nodes-in-between-zeros
merge-nodes-in-between-zeros__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 the head of a linked list, which contains a series of inte...
number-of-ways-to-build-sturdy-brick-wall
number-of-ways-to-build-sturdy-brick-wall__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 integers height and width which specify the dimensions of ...
counting-words-with-a-given-prefix
counting-words-with-a-given-prefix__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 array of strings words and a string pref.\n\nReturn the...
counting-words-with-a-given-prefix
counting-words-with-a-given-prefix__02__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 array of strings words and a string pref.\n\nReturn the...
minimum-number-of-steps-to-make-two-strings-anagram-ii
minimum-number-of-steps-to-make-two-strings-anagram-ii__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 t. In one step, you can append any chara...
minimum-time-to-finish-the-race
minimum-time-to-finish-the-race__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 2D integer array tires where tires[i] = [fi, r...
number-of-ways-to-build-house-of-cards
number-of-ways-to-build-house-of-cards__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 an integer n representing the number of playing cards you ...
sort-the-jumbled-numbers
sort-the-jumbled-numbers__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 integer array mapping which represents the map...
minimum-number-of-moves-to-make-palindrome
minimum-number-of-moves-to-make-palindrome__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 string s consisting only of lowercase English letters.\n...
cells-in-a-range-on-an-excel-sheet
cells-in-a-range-on-an-excel-sheet__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 cell (r, c) of an excel sheet is represented as a string \"<col><row>\...
find-all-k-distant-indices-in-an-array
find-all-k-distant-indices-in-an-array__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 integer array nums and two integers key and k....
find-all-k-distant-indices-in-an-array
find-all-k-distant-indices-in-an-array__03__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 integer array nums and two integers key and k....
count-artifacts-that-can-be-extracted
count-artifacts-that-can-be-extracted__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\nThere is an n x n 0-indexed grid with some artifacts buried in it. You a...
maximize-the-topmost-element-after-k-moves
maximize-the-topmost-element-after-k-moves__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 representing the contents o...
distance-to-a-cycle-in-undirected-graph
distance-to-a-cycle-in-undirected-graph__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 n representing the number of nodes in a...
divide-array-into-equal-pairs
divide-array-into-equal-pairs__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 integer array nums consisting of 2 * n integers.\n\nYou...
maximize-number-of-subsequences-in-a-string
maximize-number-of-subsequences-in-a-string__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 string text and another 0-indexed string patte...
minimum-white-tiles-after-covering-with-carpets
minimum-white-tiles-after-covering-with-carpets__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 a 0-indexed binary string floor, which represents the colo...
count-hills-and-valleys-in-an-array
count-hills-and-valleys-in-an-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. An index i is part of a hi...