slug
stringlengths
4
77
solution_id
stringlengths
16
89
primary_algorithm
stringclasses
22 values
verified
bool
1 class
messages
listlengths
3
3
minimum-steps-to-convert-string-with-operations
minimum-steps-to-convert-string-with-operations__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 strings, word1 and word2, of equal length. You need to...
count-odd-letters-from-number
count-odd-letters-from-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\nYou are given an integer n perform the following steps:\n\n\tConvert eac...
generate-tag-for-video-caption
generate-tag-for-video-caption__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 caption representing the caption for a video.\n\n...
count-special-triplets
count-special-triplets__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.\n\nA special triplet is defined as ...
maximum-product-of-first-and-last-elements-of-a-subsequence
maximum-product-of-first-and-last-elements-of-a-subsequence__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 nums and an integer m.\n\nReturn the maxi...
minimum-adjacent-swaps-to-alternate-parity
minimum-adjacent-swaps-to-alternate-parity__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 nums of distinct integers.\n\nIn one operation, y...
find-maximum-area-of-a-triangle
find-maximum-area-of-a-triangle__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 2D array coords of size n x 2, representing the coordina...
kth-smallest-path-xor-sum
kth-smallest-path-xor-sum__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 undirected tree rooted at node 0 with n nodes numbered ...
minimum-cost-path-with-alternating-directions-i
minimum-cost-path-with-alternating-directions-i__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 representing the number of rows and c...
partition-string
partition-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\nGiven a string s, partition it into unique segments according to the fol...
partition-array-to-minimize-xor
partition-array-to-minimize-xor__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 and an integer k.\n\nYour task is to...
maximize-spanning-tree-stability-with-upgrades
maximize-spanning-tree-stability-with-upgrades__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 integer n, representing n nodes numbered from 0 to n - ...
hexadecimal-and-hexatrigesimal-conversion
hexadecimal-and-hexatrigesimal-conversion__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 n.\n\nReturn the concatenation of the hexadecim...
coupon-code-validator
coupon-code-validator__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 three arrays of length n that describe the properties of n...
minimum-time-for-k-connected-components
minimum-time-for-k-connected-components__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 integer n and an undirected graph with n nodes labeled ...
minimum-number-of-primes-to-sum-to-target
minimum-number-of-primes-to-sum-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\nYou are given two integers n and m.\n\nYou have to select a multiset of ...
process-string-with-special-operations-i
process-string-with-special-operations-i__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 lowercase English letters and the...
minimize-maximum-component-cost
minimize-maximum-component-cost__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 undirected connected graph with n nodes labeled from 0 ...
process-string-with-special-operations-ii
process-string-with-special-operations-ii__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 s consisting of lowercase English letters and the...
number-of-student-replacements
number-of-student-replacements__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 ranks where ranks[i] represents the rank ...
split-array-by-prime-indices
split-array-by-prime-indices__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 nums.\n\nSplit nums into two arrays A and...
check-divisibility-by-digit-sum-and-product
check-divisibility-by-digit-sum-and-product__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 positive integer n. Determine whether n is divisible by ...
count-number-of-trapezoids-i
count-number-of-trapezoids-i__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 2D integer array points, where points[i] = [xi, yi] repr...
count-number-of-trapezoids-ii
count-number-of-trapezoids-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 a 2D integer array points where points[i] = [xi, yi] repre...
maximum-median-sum-of-subsequences-of-size-3
maximum-median-sum-of-subsequences-of-size-3__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 with a length divisible by 3.\n\nYou...
maximum-number-of-subsequences-after-one-inserting
maximum-number-of-subsequences-after-one-inserting__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 consisting of uppercase English letters.\n\nYou...
minimum-jumps-to-reach-end-via-prime-teleportation
minimum-jumps-to-reach-end-via-prime-teleportation__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 an integer array nums of length n.\n\nYou start at index 0...
sort-threats-by-severity-and-exploitability
sort-threats-by-severity-and-exploitability__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 2D integer array threats, where each threats[i] = [IDi, ...
earliest-finish-time-for-land-and-water-rides-i
earliest-finish-time-for-land-and-water-rides-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 categories of theme park attractions: land rides and w...
minimum-removals-to-balance-array
minimum-removals-to-balance-array__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 an integer array nums and an integer k.\n\nAn array is con...
earliest-finish-time-for-land-and-water-rides-ii
earliest-finish-time-for-land-and-water-rides-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 categories of theme park attractions: land rides and w...
trionic-array-i
trionic-array-i__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 of length n.\n\nAn array is trionic ...
maximum-balanced-shipments
maximum-balanced-shipments__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 weight of length n, representing the weig...
trionic-array-ii
trionic-array-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 array nums of length n.\n\nA trionic subarray i...
longest-semi-repeating-subarray
longest-semi-repeating-subarray__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 an integer array nums of length n and an integer k.\n\nA s...
maximum-k-to-sort-a-permutation
maximum-k-to-sort-a-permutation__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 of length n, where nums is a permuta...
maximum-total-from-optimal-activation-order
maximum-total-from-optimal-activation-order__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 integer arrays value and limit, both of length n.\n\nI...
maximum-weight-in-two-bags
maximum-weight-in-two-bags__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 weights and two integers w1 and w2 repres...
minimum-cost-path-with-teleportations
minimum-cost-path-with-teleportations__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 m x n 2D integer array grid and an integer k. You start ...
best-time-to-buy-and-sell-stock-using-strategy
best-time-to-buy-and-sell-stock-using-strategy__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 two integer arrays prices and strategy, where:\n\n\tprices...
xor-after-range-multiplication-queries-ii
xor-after-range-multiplication-queries-ii__01__python
Divide and Conquer
true
[ { "role": "system", "content": "You 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 a 2D integer array q...
gcd-of-odd-and-even-sums
gcd-of-odd-and-even-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 an integer n. Your task is to compute the GCD (greatest co...
partition-array-into-k-distinct-groups
partition-array-into-k-distinct-groups__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 and an integer k.\n\nYour task is to...
jump-game-ix
jump-game-ix__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.\n\nFrom any index i, you can jump t...
filter-characters-by-frequency
filter-characters-by-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\nYou are given a string s consisting of lowercase English letters and an ...
sort-array-by-absolute-value
sort-array-by-absolute-value__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 nums.\n\nRearrange elements of nums in no...
restore-finishing-order
restore-finishing-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\nYou are given an integer array order of length n and an integer array fr...
minimum-operations-to-equalize-array
minimum-operations-to-equalize-array__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 of length n.\n\nIn one operation, ch...
minimum-operations-to-transform-string
minimum-operations-to-transform-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 string s consisting only of lowercase English letters.\n...
smallest-absent-positive-greater-than-average
smallest-absent-positive-greater-than-average__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.\n\nReturn the smallest absent posit...
minimum-discards-to-balance-inventory
minimum-discards-to-balance-inventory__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 two integers w and m, and an integer array arrivals, where...
minimum-index-sum-of-common-elements
minimum-index-sum-of-common-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 two integer arrays nums1 and nums2 of equal length n.\n\nW...
earliest-time-to-finish-one-task
earliest-time-to-finish-one-task__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 tasks where tasks[i] = [si, ti].\n\nEac...
maximize-sum-of-at-most-k-distinct-elements
maximize-sum-of-at-most-k-distinct-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\nYou are given a positive integer array nums and an integer k.\n\nChoose ...
library-late-fee-calculator
library-late-fee-calculator__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 daysLate where daysLate[i] indicates how ...
maximum-total-subarray-value-i
maximum-total-subarray-value-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 an integer array nums of length n and an integer k.\n\nYou...
climbing-stairs-ii
climbing-stairs-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 climbing a staircase with n + 1 steps, numbered from 0 to n.\n\n...
distinct-points-reachable-after-substring-removal
distinct-points-reachable-after-substring-removal__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 string s consisting of characters 'U', 'D', 'L', and 'R'...
compute-decimal-representation
compute-decimal-representation__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 positive integer n.\n\nA positive integer is a base-10 c...
compute-alternating-sum
compute-alternating-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\nYou are given an integer array nums.\n\nThe alternating sum of nums is t...
longest-subsequence-with-non-zero-bitwise-xor
longest-subsequence-with-non-zero-bitwise-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\nYou are given an integer array nums.\n\nReturn the length of the longest...
count-no-zero-pairs-that-sum-to-n
count-no-zero-pairs-that-sum-to-n__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 no-zero integer is a positive integer that does not contain the digit ...
equal-score-substrings
equal-score-substrings__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 s consisting of lowercase English letters.\n\nThe...
longest-fibonacci-subarray
longest-fibonacci-subarray__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 positive integers nums.\n\nA Fibonacci array i...
sum-of-elements-with-frequency-divisible-by-k
sum-of-elements-with-frequency-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\nYou are given an integer array nums and an integer k.\n\nReturn an integ...
longest-balanced-substring-i
longest-balanced-substring-i__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 string s consisting of lowercase English letters.\n\nA s...
longest-balanced-substring-ii
longest-balanced-substring-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 a string s consisting only of the characters 'a', 'b', and...
minimum-operations-to-make-the-array-beautiful
minimum-operations-to-make-the-array-beautiful__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.\n\nAn array is called beautiful if ...
longest-balanced-subarray-i
longest-balanced-subarray-i__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.\n\nA subarray is called balanced if...
longest-balanced-subarray-ii
longest-balanced-subarray-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 an integer array nums.\n\nA subarray is called balanced if...
lexicographically-smallest-string-after-reverse
lexicographically-smallest-string-after-reverse__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 string s of length n consisting of lowercase English let...
minimum-operations-to-transform-array
minimum-operations-to-transform-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 two integer arrays nums1 of length n and nums2 of length n...
remove-zeros-in-decimal-representation
remove-zeros-in-decimal-representation__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 positive integer n.\n\nReturn the integer obtained by re...
maximum-alternating-sum-of-squares
maximum-alternating-sum-of-squares__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 nums. You may rearrange the elements in a...
count-distinct-subarrays-divisible-by-k-in-sorted-array
count-distinct-subarrays-divisible-by-k-in-sorted-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 sorted in non-descending order and a...
maximum-calories-burnt-from-jumps
maximum-calories-burnt-from-jumps__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 heights of size n, where heights[i] repre...
find-missing-elements
find-missing-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 an integer array nums consisting of unique integers.\n\nOr...
maximum-product-of-three-elements-after-one-replacement
maximum-product-of-three-elements-after-one-replacement__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 nums.\n\nYou must replace exactly one ele...
minimum-moves-to-equal-array-elements-iii
minimum-moves-to-equal-array-elements-iii__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 nums.\n\nIn one move, you may increase th...
count-subarrays-with-majority-element-i
count-subarrays-with-majority-element-i__01__python
Divide and Conquer
true
[ { "role": "system", "content": "You 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 target.\n\nReturn the...
longest-non-decreasing-subarray-after-replacing-at-most-one-element
longest-non-decreasing-subarray-after-replacing-at-most-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\nYou are given an integer array nums.\n\nYou are allowed to replace at mo...
count-subarrays-with-majority-element-ii
count-subarrays-with-majority-element-ii__01__python
Divide and Conquer
true
[ { "role": "system", "content": "You 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 target.\n\nReturn the...
minimum-distance-between-three-equal-elements-i
minimum-distance-between-three-equal-elements-i__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.\n\nA tuple (i, j, k) of 3 distinct ...
minimum-distance-between-three-equal-elements-ii
minimum-distance-between-three-equal-elements-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 an integer array nums.\n\nA tuple (i, j, k) of 3 distinct ...
maximum-path-score-in-a-grid
maximum-path-score-in-a-grid__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 m x n grid where each cell contains one of the values 0...
find-kth-character-in-expanded-string
find-kth-character-in-expanded-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 one or more words separated by si...
maximize-expression-of-three-elements
maximize-expression-of-three-elements__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\nChoose three elements a, b, and ...
minimum-string-length-after-balanced-removals
minimum-string-length-after-balanced-removals__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 s consisting only of the characters 'a' and 'b'.\...
count-distinct-integers-after-removing-zeros
count-distinct-integers-after-removing-zeros__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 positive integer n.\n\nFor every integer x from 1 to n, ...
evaluate-valid-expressions
evaluate-valid-expressions__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 a string expression that represents a nested mathematical ...
minimum-number-of-flips-to-reverse-binary-string
minimum-number-of-flips-to-reverse-binary-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 positive integer n.\n\nLet s be the binary representatio...
total-waviness-of-numbers-in-range-i
total-waviness-of-numbers-in-range-i__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 num1 and num2 representing an inclusive range...
concatenate-non-zero-digits-and-multiply-by-sum-i
concatenate-non-zero-digits-and-multiply-by-sum-i__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 n.\n\nForm a new integer x by concatenating all...
find-maximum-balanced-xor-subarray-length
find-maximum-balanced-xor-subarray-length__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 the length of the longest subarray t...
convert-number-words-to-digits
convert-number-words-to-digits__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\nYou are given a string s consisting of lowercase English letters. s may ...
count-elements-with-at-least-k-greater-values
count-elements-with-at-least-k-greater-values__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 nums of length n and an integer k.\n\nAn ...
maximum-substrings-with-distinct-start
maximum-substrings-with-distinct-start__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 string s consisting of lowercase English letters.\n\nRet...
minimum-absolute-distance-between-mirror-pairs
minimum-absolute-distance-between-mirror-pairs__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.\n\nA mirror pair is a pair of indic...
maximize-points-after-choosing-k-tasks
maximize-points-after-choosing-k-tasks__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 integer arrays, technique1 and technique2, each of len...
sort-integers-by-binary-reflection
sort-integers-by-binary-reflection__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 nums.\n\nThe binary reflection of a posit...