slug
stringlengths
4
77
solution_id
stringlengths
16
89
primary_algorithm
stringclasses
22 values
verified
bool
1 class
messages
listlengths
3
3
absolute-difference-between-maximum-and-minimum-k-elements
absolute-difference-between-maximum-and-minimum-k-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 an integer array nums and an integer k.\n\nFind the absolu...
reverse-words-with-same-vowel-count
reverse-words-with-same-vowel-count__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 words, each sep...
minimum-moves-to-balance-circular-array
minimum-moves-to-balance-circular-array__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a circular array balance of length n, where balance[i] is ...
minimum-deletions-to-make-alternating-substring
minimum-deletions-to-make-alternating-substring__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 of length n consisting only of the characters '...
minimum-number-of-operations-to-have-distinct-elements
minimum-number-of-operations-to-have-distinct-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.\n\nIn one operation, you remove the...
maximum-sum-of-three-numbers-divisible-by-three
maximum-sum-of-three-numbers-divisible-by-three__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\nYour task is to choose exactly t...
mirror-distance-of-an-integer
mirror-distance-of-an-integer__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\nDefine its mirror distance as: abs(n - re...
minimum-deletion-cost-to-make-all-characters-equal
minimum-deletion-cost-to-make-all-characters-equal__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 of length n and an integer array cost of the sa...
maximum-score-of-a-split
maximum-score-of-a-split__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\nChoose an index i su...
minimum-cost-to-acquire-required-items
minimum-cost-to-acquire-required-items__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 five integers cost1, cost2, costBoth, need1, and need2.\n\...
smallest-all-ones-multiple
smallest-all-ones-multiple__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 k.\n\nFind the smallest integer n divis...
number-of-balanced-integers-in-a-range
number-of-balanced-integers-in-a-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 integers low and high.\n\nAn integer is called balance...
sum-of-increasing-product-blocks
sum-of-increasing-product-blocks__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\nA sequence is formed as follows:\n\n\tThe...
reverse-string-prefix
reverse-string-prefix__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 k.\n\nReverse the first k charac...
minimum-subarray-length-with-distinct-sum-at-least-k
minimum-subarray-length-with-distinct-sum-at-least-k__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 and an integer k.\n\nReturn the mini...
largest-even-number
largest-even-number__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 '1' and '2'.\...
word-squares-ii
word-squares-ii__01__python
Backtracking
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a string array words, consisting of distinct 4-letter stri...
minimum-cost-to-make-two-binary-strings-equal
minimum-cost-to-make-two-binary-strings-equal__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 binary strings s and t, both of length n, and three po...
count-residue-prefixes
count-residue-prefixes__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 lowercase English letters.\n...
number-of-centered-subarrays
number-of-centered-subarrays__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 of nums is called cen...
count-caesar-cipher-pairs
count-caesar-cipher-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\nYou are given an array words of n strings. Each string has length m and ...
maximum-bitwise-and-after-increment-operations
maximum-bitwise-and-after-increment-operations__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 two integers k and m.\n\nYou may...
best-reachable-tower
best-reachable-tower__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 2D integer array towers, where towers[i] = [xi, yi, qi] ...
minimum-operations-to-reach-target-array
minimum-operations-to-reach-target-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 two integer arrays nums and target, each of length n, wher...
number-of-alternating-xor-partitions
number-of-alternating-xor-partitions__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 two distinct integers target1 an...
vowel-consonant-score
vowel-consonant-score__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, spaces...
lexicographically-smallest-string-after-deleting-duplicate-characters
lexicographically-smallest-string-after-deleting-duplicate-characters__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 that consists of lowercase English letters.\n\n...
good-indices-in-a-digit-string
good-indices-in-a-digit-string__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a string s consisting of digits.\n\nAn index i is called g...
minimum-prefix-removal-to-make-array-strictly-increasing
minimum-prefix-removal-to-make-array-strictly-increasing__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.\n\nYou need to remove exactly one p...
rotate-non-negative-elements
rotate-non-negative-elements__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 and an integer k.\n\nRotate only the...
pythagorean-distance-nodes-in-a-tree
pythagorean-distance-nodes-in-a-tree__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 n and an undirected tree with n nodes numbered ...
find-nth-smallest-integer-with-k-one-bits
find-nth-smallest-integer-with-k-one-bits__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given two positive integers n and k.\n\nReturn an integer denoti...
reverse-letters-then-special-characters-in-a-string
reverse-letters-then-special-characters-in-a-string__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a string s consisting of lowercase English letters and spe...
minimum-k-to-reduce-array-within-limit
minimum-k-to-reduce-array-within-limit__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 positive integer array nums.\n\nFor a positive integer k...
count-monobit-integers
count-monobit-integers__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an integer n.\n\nAn integer is called Monobit if all bits ...
final-element-after-subarray-deletions
final-element-after-subarray-deletions__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\nTwo players, Alice and Bob, play...
longest-alternating-subarray-after-removing-at-most-one-element
longest-alternating-subarray-after-removing-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\nA subarray nums[l..r] is alterna...
count-dominant-indices
count-dominant-indices__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 element at index ...
merge-adjacent-equal-elements
merge-adjacent-equal-elements__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.\n\nYou must repeatedly apply the fo...
count-subarrays-with-cost-less-than-or-equal-to-k
count-subarrays-with-cost-less-than-or-equal-to-k__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 k.\n\nFor any subarr...
delayed-count-of-equal-elements
delayed-count-of-equal-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 of length n and an integer k.\n\nFor...
number-of-prefix-connected-groups
number-of-prefix-connected-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 array of strings words and an integer k.\n\nTwo words a...
house-robber-v
house-robber-v__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 a professional robber planning to rob houses along a street. Eac...
first-element-with-unique-frequency
first-element-with-unique-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 an integer array nums.\n\nReturn an integer denoting the f...
longest-almost-palindromic-substring
longest-almost-palindromic-substring__01__python
Brute Force
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a string s consisting of lowercase English letters.\n\nA s...
total-distance-to-type-a-string-using-one-finger
total-distance-to-type-a-string-using-one-finger__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 is a special keyboard where keys are arranged in a rectangular gri...
find-the-score-difference-in-a-game
find-the-score-difference-in-a-game__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums, where nums[i] represents the points...
maximum-bitwise-xor-after-rearrangement
maximum-bitwise-xor-after-rearrangement__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 binary strings s and t​​​​​​​, each of length n.\n\nYo...
maximum-requests-without-violating-the-limit
maximum-requests-without-violating-the-limit__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 2D integer array requests, where requests[i] = [useri, t...
smallest-pair-with-different-frequencies
smallest-pair-with-different-frequencies__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\nConsider all pairs of distinct v...
merge-close-characters
merge-close-characters__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 ...
minimum-operations-to-make-array-parity-alternating
minimum-operations-to-make-array-parity-alternating__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\nAn array is called parity altern...
sum-of-k-digit-numbers-in-a-range
sum-of-k-digit-numbers-in-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 three integers l, r, and k.\n\nConsider all possible integ...
trim-trailing-vowels
trim-trailing-vowels__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 that consists of lowercase English letters.\n\n...
minimum-cost-to-split-into-ones
minimum-cost-to-split-into-ones__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\nIn one operation, you may split an intege...
minimum-bitwise-or-from-grid
minimum-bitwise-or-from-grid__01__python
Brute Force
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 2D integer array grid of size m x n.\n\nYou must select ...
count-subarrays-with-k-distinct-integers
count-subarrays-with-k-distinct-integers__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 and two integers k and m.\n\nReturn ...
unique-email-groups
unique-email-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 array of strings emails, where each string is a valid e...
minimum-capacity-box
minimum-capacity-box__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 capacity, where capacity[i] represents th...
find-the-smallest-balanced-index
find-the-smallest-balanced-index__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.\n\nAn index i is balanced if the su...
minimum-cost-to-partition-a-binary-string
minimum-cost-to-partition-a-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\nYou are given a binary string s and two integers encCost and flatCost.\n...
reverse-k-subarrays
reverse-k-subarrays__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 of length n and an integer k.\n\nYou...
first-unique-even-element
first-unique-even-element__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 an integer denoting the f...
minimum-cost-to-equalize-arrays-using-swaps
minimum-cost-to-equalize-arrays-using-swaps__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 size n.\n\nYou can p...
count-fancy-numbers-in-a-range
count-fancy-numbers-in-a-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 integers l and r.\n\nAn integer is called good if its ...
count-commas-in-range
count-commas-in-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 an integer n.\n\nReturn the total number of commas used wh...
count-commas-in-range-ii
count-commas-in-range-ii__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 total number of commas used wh...
longest-arithmetic-sequence-after-changing-at-most-one-element
longest-arithmetic-sequence-after-changing-at-most-one-element__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.\n\nA subarray is arithmetic if the ...
maximum-points-activated-with-one-addition
maximum-points-activated-with-one-addition__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 2D integer array points, where points[i] = [xi, yi] repr...
valid-subarrays-with-exactly-one-peak
valid-subarrays-with-exactly-one-peak__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 of length n and an integer k.\n\nAn ...
construct-uniform-parity-array-i
construct-uniform-parity-array-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 array nums1 of n distinct integers.\n\nYou want to cons...
construct-uniform-parity-array-ii
construct-uniform-parity-array-ii__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 nums1 of n distinct integers.\n\nYou want to cons...
minimum-removals-to-achieve-target-xor
minimum-removals-to-achieve-target-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 target.\n\nYou may re...
count-good-subarrays
count-good-subarrays__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\nA subarray is called good if the...
minimum-absolute-difference-between-two-values
minimum-absolute-difference-between-two-values__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 consisting only of 0, 1, and 2.\n\nA...
first-matching-character-from-both-ends
first-matching-character-from-both-ends__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 of length n consisting of lowercase English let...
minimum-operations-to-make-all-grid-elements-equal
minimum-operations-to-make-all-grid-elements-equal__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 2D integer array grid of size m × n, and an intege...
mirror-frequency-distance
mirror-frequency-distance__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 dig...
minimum-increase-to-maximize-special-indices
minimum-increase-to-maximize-special-indices__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\nAn index i (0 < i < ...
traffic-signal-color
traffic-signal-color__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 timer representing the remaining time (in secon...
count-digit-appearances
count-digit-appearances__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 and an integer digit.\n\nReturn the ...
maximum-value-of-concatenated-binary-segments
maximum-value-of-concatenated-binary-segments__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 and nums0, each of size n.\n\n\tn...
find-the-degree-of-each-vertex
find-the-degree-of-each-vertex__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 matrix of size n x n representing the a...
longest-balanced-substring-after-one-swap
longest-balanced-substring-after-one-swap__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 binary string s consisting only of characters '0' and '1...
zigzag-level-sum-of-binary-tree
zigzag-level-sum-of-binary-tree__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 the root of a binary tree.\n\nTraverse the tree level by l...
smallest-stable-index-i
smallest-stable-index-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 and an integer k.\n\nFor...
smallest-stable-index-ii
smallest-stable-index-ii__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 and an integer k.\n\nFor...
count-good-integers-on-a-grid-path
count-good-integers-on-a-grid-path__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 l and r, and a string directions consisting o...
valid-digit-number
valid-digit-number__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an integer n and a digit x.\n\nA number is considered vali...
count-connected-subgraphs-with-even-node-sum
count-connected-subgraphs-with-even-node-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 graph with n nodes labeled from 0 to n - 1. ...
valid-elements-in-an-array
valid-elements-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 an integer array nums.\n\nAn element nums[i] is considered...
sort-vowels-by-frequency
sort-vowels-by-frequency__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 string s consisting of lowercase English characters.\n\n...
maximum-sum-of-alternating-subsequence-with-distance-at-least-k
maximum-sum-of-alternating-subsequence-with-distance-at-least-k__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 k.\n\nPic...
count-indices-with-opposite-parity
count-indices-with-opposite-parity__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\nThe score of an inde...
sum-of-primes-between-number-and-its-reverse
sum-of-primes-between-number-and-its-reverse__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\nLet r be the integer formed by reversing ...
minimum-cost-to-move-between-indices
minimum-cost-to-move-between-indices__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 where nums is strictly increasing.\n...
score-validator
score-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 a string array events.\n\nInitially, score = 0 and counter...
concatenate-array-with-reverse
concatenate-array-with-reverse__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 of length n.\n\nConstruct a new arra...
count-valid-word-occurrences
count-valid-word-occurrences__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 an array of strings chunks. Concatenate all strings in chu...
smallest-unique-subarray
smallest-unique-subarray__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 array nums.\n\nFind the minimum length of a sub...