slug
stringlengths
4
77
solution_id
stringlengths
16
89
primary_algorithm
stringclasses
22 values
verified
bool
1 class
messages
listlengths
3
3
reducing-dishes
reducing-dishes__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 chef has collected data on the satisfaction level of his n dishes. Che...
minimum-subsequence-in-non-increasing-order
minimum-subsequence-in-non-increasing-order__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 the array nums, obtain a subsequence of the array whose sum of ele...
number-of-steps-to-reduce-a-number-in-binary-representation-to-one
number-of-steps-to-reduce-a-number-in-binary-representation-to-one__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 the binary representation of an integer as a string s, return the ...
stone-game-iii
stone-game-iii__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\nAlice and Bob continue their games with piles of stones. There are sever...
string-matching-in-an-array
string-matching-in-an-array__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\nGiven an array of string words, return all strings in words that are a s...
queries-on-a-permutation-with-key
queries-on-a-permutation-with-key__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 the array queries of positive integers between 1 and m, you have t...
queries-on-a-permutation-with-key
queries-on-a-permutation-with-key__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\nGiven the array queries of positive integers between 1 and m, you have t...
html-entity-parser
html-entity-parser__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\nHTML entity parser is the parser that takes HTML code as input and repla...
number-of-ways-to-paint-n-3-grid
number-of-ways-to-paint-n-3-grid__01__python
Recursion
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 grid of size n x 3 and you want to paint each cell of the gri...
number-of-ways-to-paint-n-3-grid
number-of-ways-to-paint-n-3-grid__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 have a grid of size n x 3 and you want to paint each cell of the gri...
find-the-minimum-number-of-fibonacci-numbers-whose-sum-is-k
find-the-minimum-number-of-fibonacci-numbers-whose-sum-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\nGiven an integer k, return the minimum number of Fibonacci numbers whose...
the-k-th-lexicographical-string-of-all-happy-strings-of-length-n
the-k-th-lexicographical-string-of-all-happy-strings-of-length-n__01__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\nA happy string is a string that:\n\n\tconsists only of letters of the se...
the-k-th-lexicographical-string-of-all-happy-strings-of-length-n
the-k-th-lexicographical-string-of-all-happy-strings-of-length-n__02__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 happy string is a string that:\n\n\tconsists only of letters of the se...
minimum-number-of-frogs-croaking
minimum-number-of-frogs-croaking__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 string croakOfFrogs, which represents a combination of...
build-array-where-you-can-find-the-maximum-exactly-k-comparisons
build-array-where-you-can-find-the-maximum-exactly-k-comparisons__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 three integers n, m and k. Consider the following algorith...
maximum-score-after-splitting-a-string
maximum-score-after-splitting-a-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 of zeros and ones, return the maximum score after split...
maximum-points-you-can-obtain-from-cards
maximum-points-you-can-obtain-from-cards__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\nThere are several cards arranged in a row, and each card has an associat...
diagonal-traverse-ii
diagonal-traverse-ii__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, return all elements of nums in diagonal o...
counting-elements
counting-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\nGiven an integer array arr, count how many elements x there are, such th...
perform-string-shifts
perform-string-shifts__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 containing lowercase English letters, and a mat...
max-difference-you-can-get-from-changing-an-integer
max-difference-you-can-get-from-changing-an-integer__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 num. You will apply the following steps to num ...
check-if-a-string-can-break-another-string
check-if-a-string-can-break-another-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\nGiven two strings: s1 and s2 with the same size, check if some permutati...
number-of-ways-to-wear-different-hats-to-each-other
number-of-ways-to-wear-different-hats-to-each-other__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 are n people and 40 types of hats labeled from 1 to 40.\n\nGiven a...
destination-city
destination-city__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 the array paths, where paths[i] = [cityAi, cityBi] means t...
check-if-all-1s-are-at-least-length-k-places-away
check-if-all-1s-are-at-least-length-k-places-away__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 binary array nums and an integer k, return true if all 1's are ...
longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit
longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit__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\nGiven an array of integers nums and an integer limit, return the size of...
longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit
longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit__03__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\nGiven an array of integers nums and an integer limit, return the size of...
find-the-kth-smallest-sum-of-a-matrix-with-sorted-rows
find-the-kth-smallest-sum-of-a-matrix-with-sorted-rows__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 an m x n matrix mat that has its rows sorted in non-decrea...
build-an-array-with-stack-operations
build-an-array-with-stack-operations__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 array target and an integer n.\n\nYou have an e...
count-triplets-that-can-form-two-arrays-of-equal-xor
count-triplets-that-can-form-two-arrays-of-equal-xor__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\nGiven an array of integers arr.\n\nWe want to select three indices i, j ...
minimum-time-to-collect-all-apples-in-a-tree
minimum-time-to-collect-all-apples-in-a-tree__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 an undirected tree consisting of n vertices numbered from 0 to n-1...
number-of-ways-of-cutting-a-pizza
number-of-ways-of-cutting-a-pizza__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\nGiven a rectangular pizza represented as a rows x cols matrix containing...
count-good-nodes-in-binary-tree
count-good-nodes-in-binary-tree__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 a binary tree root, a node X in the tree is named good if in the p...
form-largest-integer-with-digits-that-add-up-to-target
form-largest-integer-with-digits-that-add-up-to-target__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\nGiven an array of integers cost and an integer target, return the maximu...
number-of-students-doing-homework-at-a-given-time
number-of-students-doing-homework-at-a-given-time__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 two integer arrays startTime and endTime and given an integer quer...
people-whose-list-of-favorite-companies-is-not-a-subset-of-another-list
people-whose-list-of-favorite-companies-is-not-a-subset-of-another-list__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 the array favoriteCompanies where favoriteCompanies[i] is the list...
check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence
check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence__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\nGiven a sentence that consists of some words separated by a single space...
maximum-number-of-vowels-in-a-substring-of-given-length
maximum-number-of-vowels-in-a-substring-of-given-length__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\nGiven a string s and an integer k, return the maximum number of vowel le...
pseudo-palindromic-paths-in-a-binary-tree
pseudo-palindromic-paths-in-a-binary-tree__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 a binary tree where node values are digits from 1 to 9. A path in ...
make-two-arrays-equal-by-reversing-subarrays
make-two-arrays-equal-by-reversing-subarrays__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 two integer arrays of equal length target and arr. In one ...
make-two-arrays-equal-by-reversing-subarrays
make-two-arrays-equal-by-reversing-subarrays__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\nYou are given two integer arrays of equal length target and arr. In one ...
check-if-a-string-contains-all-binary-codes-of-size-k
check-if-a-string-contains-all-binary-codes-of-size-k__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 binary string s and an integer k, return true if every binary co...
check-if-a-string-contains-all-binary-codes-of-size-k
check-if-a-string-contains-all-binary-codes-of-size-k__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\nGiven a binary string s and an integer k, return true if every binary co...
maximum-product-of-two-elements-in-an-array
maximum-product-of-two-elements-in-an-array__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 the array of integers nums, you will choose two different indices ...
maximum-product-of-two-elements-in-an-array
maximum-product-of-two-elements-in-an-array__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 the array of integers nums, you will choose two different indices ...
maximum-product-of-two-elements-in-an-array
maximum-product-of-two-elements-in-an-array__03__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 the array of integers nums, you will choose two different indices ...
find-all-the-lonely-nodes
find-all-the-lonely-nodes__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\nIn a binary tree, a lonely node is a node that is the only child of its ...
shuffle-the-array
shuffle-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 the array nums consisting of 2n elements in the form [x1,x2,...,xn...
the-k-strongest-values-in-an-array
the-k-strongest-values-in-an-array__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 array of integers arr and an integer k.\n\nA value arr[i] is sa...
paint-house-iii
paint-house-iii__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 row of m houses in a small city, each house must be painted w...
delete-n-nodes-after-m-nodes-of-a-linked-list
delete-n-nodes-after-m-nodes-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\nYou are given the head of a linked list and two integers m and n.\n\nTra...
final-prices-with-a-special-discount-in-a-shop
final-prices-with-a-special-discount-in-a-shop__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 prices where prices[i] is the price of th...
find-two-non-overlapping-sub-arrays-each-with-target-sum
find-two-non-overlapping-sub-arrays-each-with-target-sum__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 of integers arr and an integer target.\n\nYou hav...
allocate-mailboxes
allocate-mailboxes__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\nGiven the array houses where houses[i] is the location of the ith house ...
making-file-names-unique
making-file-names-unique__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 array of strings names of size n. You will create n folders in ...
average-salary-excluding-the-minimum-and-maximum-salary
average-salary-excluding-the-minimum-and-maximum-salary__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 array of unique integers salary where salary[i] is the ...
the-kth-factor-of-n
the-kth-factor-of-n__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 two positive integers n and k. A factor of an integer n is...
the-kth-factor-of-n
the-kth-factor-of-n__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 positive integers n and k. A factor of an integer n is...
longest-subarray-of-1s-after-deleting-one-element
longest-subarray-of-1s-after-deleting-one-element__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\nGiven a binary array nums, you should delete one element from it.\n\nRet...
longest-subarray-of-1s-after-deleting-one-element
longest-subarray-of-1s-after-deleting-one-element__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\nGiven a binary array nums, you should delete one element from it.\n\nRet...
longest-subarray-of-1s-after-deleting-one-element
longest-subarray-of-1s-after-deleting-one-element__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\nGiven a binary array nums, you should delete one element from it.\n\nRet...
parallel-courses-ii
parallel-courses-ii__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 n, which indicates that there are n courses lab...
path-crossing
path-crossing__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 path, where path[i] = 'N', 'S', 'E' or 'W', each represen...
check-if-array-pairs-are-divisible-by-k
check-if-array-pairs-are-divisible-by-k__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 array of integers arr of even length n and an integer k.\n\nWe ...
last-moment-before-all-ants-fall-out-of-a-plank
last-moment-before-all-ants-fall-out-of-a-plank__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\nWe have a wooden plank of the length n units. Some ants are walking on t...
count-submatrices-with-all-ones
count-submatrices-with-all-ones__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\nGiven an m x n binary matrix mat, return the number of submatrices that ...
minimum-possible-integer-after-at-most-k-adjacent-swaps-on-digits
minimum-possible-integer-after-at-most-k-adjacent-swaps-on-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 string num representing the digits of a very large integ...
reformat-date
reformat-date__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 date string in the form Day Month Year, where:\n\n\tDay is in th...
range-sum-of-sorted-subarray-sums
range-sum-of-sorted-subarray-sums__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 array nums consisting of n positive integers. You comp...
minimum-difference-between-largest-and-smallest-value-in-three-moves
minimum-difference-between-largest-and-smallest-value-in-three-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 an integer array nums.\n\nIn one move, you can choose one ...
number-of-good-pairs
number-of-good-pairs__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 integers nums, return the number of good pairs.\n\nA p...
number-of-substrings-with-only-1s
number-of-substrings-with-only-1s__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 binary string s, return the number of substrings with all charac...
water-bottles
water-bottles__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\nThere are numBottles water bottles that are initially full of water. You...
number-of-nodes-in-the-sub-tree-with-the-same-label
number-of-nodes-in-the-sub-tree-with-the-same-label__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...
find-a-value-of-a-mysterious-function-closest-to-target
find-a-value-of-a-mysterious-function-closest-to-target__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\nWinston was given the above mysterious function func. He has an integer ...
number-of-sub-arrays-with-odd-sum
number-of-sub-arrays-with-odd-sum__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\nGiven an array of integers arr, return the number of subarrays with an o...
number-of-good-ways-to-split-a-string
number-of-good-ways-to-split-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\nYou are given a string s.\n\nA split is called good if you can split s i...
shuffle-string
shuffle-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 and an integer array indices of the same length...
minimum-suffix-flips
minimum-suffix-flips__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 binary string target of length n. You have ano...
number-of-good-leaf-nodes-pairs
number-of-good-leaf-nodes-pairs__01__python
Recursion
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 and an integer distance. A pair ...
find-the-winner-of-an-array-game
find-the-winner-of-an-array-game__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 arr of distinct integers and an integer k.\n\nA g...
minimum-swaps-to-arrange-a-binary-grid
minimum-swaps-to-arrange-a-binary-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\nGiven an n x n binary grid, in one step you can choose two adjacent rows...
get-the-maximum-score
get-the-maximum-score__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 sorted arrays of distinct integers nums1 and nums2.\n\...
minimum-insertions-to-balance-a-parentheses-string
minimum-insertions-to-balance-a-parentheses-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\nGiven a parentheses string s containing only the characters '(' and ')'....
find-longest-awesome-substring
find-longest-awesome-substring__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 a string s. An awesome substring is a non-empty substring ...
make-the-string-great
make-the-string-great__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 of lower and upper case English letters.\n\nA good stri...
find-kth-bit-in-nth-binary-string
find-kth-bit-in-nth-binary-string__01__python
Recursion
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 positive integers n and k, the binary string Sn is formed as f...
maximum-number-of-non-overlapping-subarrays-with-sum-equals-target
maximum-number-of-non-overlapping-subarrays-with-sum-equals-target__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\nGiven an array nums and an integer target, return the maximum number of ...
minimum-cost-to-cut-a-stick
minimum-cost-to-cut-a-stick__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\nGiven a wooden stick of length n units. The stick is labelled from 0 to ...
minimum-cost-to-cut-a-stick
minimum-cost-to-cut-a-stick__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 a wooden stick of length n units. The stick is labelled from 0 to ...
minimum-operations-to-make-array-equal
minimum-operations-to-make-array-equal__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 have an array arr of length n where arr[i] = (2 * i) + 1 for all val...
minimum-number-of-days-to-eat-n-oranges
minimum-number-of-days-to-eat-n-oranges__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\nThere are n oranges in the kitchen and you decided to eat some of these ...
strings-differ-by-one-character
strings-differ-by-one-character__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 list of strings dict where all the strings are of the same lengt...
thousand-separator
thousand-separator__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 an integer n, add a dot (\".\") as the thousands separator and ret...
minimum-numbers-of-function-calls-to-make-target-array
minimum-numbers-of-function-calls-to-make-target-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 an integer array nums. You have an integer array arr of th...
most-visited-sector-in-a-circular-track
most-visited-sector-in-a-circular-track__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 n and an integer array rounds. We have a circular track...
find-latest-group-of-size-m
find-latest-group-of-size-m__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\nGiven an array arr that represents a permutation of numbers from 1 to n....
find-latest-group-of-size-m
find-latest-group-of-size-m__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\nGiven an array arr that represents a permutation of numbers from 1 to n....
put-boxes-into-the-warehouse-i
put-boxes-into-the-warehouse-i__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 arrays of positive integers, boxes and warehouse, repr...
maximum-length-of-subarray-with-positive-product
maximum-length-of-subarray-with-positive-product__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\nGiven an array of integers nums, find the maximum length of a subarray w...