slug
stringlengths
4
77
solution_id
stringlengths
16
89
primary_algorithm
stringclasses
22 values
verified
bool
1 class
messages
listlengths
3
3
total-characters-in-string-after-transformations-i
total-characters-in-string-after-transformations-i__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 and an integer t, representing the number of tr...
total-characters-in-string-after-transformations-ii
total-characters-in-string-after-transformations-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 a string s consisting of lowercase English letters, an int...
find-the-number-of-k-even-arrays
find-the-number-of-k-even-arrays__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 three integers n, m, and k.\n\nAn array arr is called k-ev...
find-the-number-of-k-even-arrays
find-the-number-of-k-even-arrays__02__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given three integers n, m, and k.\n\nAn array arr is called k-ev...
find-the-number-of-k-even-arrays
find-the-number-of-k-even-arrays__03__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given three integers n, m, and k.\n\nAn array arr is called k-ev...
maximum-sized-array
maximum-sized-array__01__python
Binary Search
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a positive integer s, let A be a 3D array of dimensions n × ...
maximum-frequency-of-an-element-after-performing-operations-i
maximum-frequency-of-an-element-after-performing-operations-i__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 numOperations...
maximum-frequency-of-an-element-after-performing-operations-ii
maximum-frequency-of-an-element-after-performing-operations-ii__01__python
Sliding Window
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums and two integers k and numOperations...
adjacent-increasing-subarrays-detection-i
adjacent-increasing-subarrays-detection-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\nGiven an array nums of n integers and an integer k, determine whether th...
adjacent-increasing-subarrays-detection-ii
adjacent-increasing-subarrays-detection-ii__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 nums of n integers, your task is to find the maximum valu...
sum-of-good-subsequences
sum-of-good-subsequences__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. A good subsequence is defined as a ...
make-array-elements-equal-to-zero
make-array-elements-equal-to-zero__01__python
Array
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums.\n\nStart by selecting a starting po...
zero-array-transformation-i
zero-array-transformation-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 a 2D array queries, ...
stone-removal-game
stone-removal-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\nAlice and Bob are playing a game where they take turns removing stones f...
shift-distance-between-two-strings
shift-distance-between-two-strings__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 two strings s and t of the same length, and two integer ar...
find-the-maximum-number-of-fruits-collected
find-the-maximum-number-of-fruits-collected__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 game dungeon comprised of n x n rooms arranged in a grid.\n\n...
minimum-positive-sum-subarray
minimum-positive-sum-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 and two integers l and r. Your task ...
rearrange-k-substrings-to-form-target-string
rearrange-k-substrings-to-form-target-string__01__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given two strings s and t, both of which are anagrams of each ot...
smallest-number-with-all-set-bits
smallest-number-with-all-set-bits__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 positive number n.\n\nReturn the smallest number x great...
identify-the-largest-outlier-in-an-array
identify-the-largest-outlier-in-an-array__01__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums. This array contains n elements, whe...
maximize-the-number-of-target-nodes-after-connecting-trees-i
maximize-the-number-of-target-nodes-after-connecting-trees-i__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\nThere exist two undirected trees with n and m nodes, with distinct label...
maximize-the-number-of-target-nodes-after-connecting-trees-ii
maximize-the-number-of-target-nodes-after-connecting-trees-ii__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\nThere exist two undirected trees with n and m nodes, labeled from [0, n ...
minimum-operations-to-make-array-values-equal-to-k
minimum-operations-to-make-array-values-equal-to-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\nAn integer h is...
count-connected-components-in-lcm-graph
count-connected-components-in-lcm-graph__01__python
Graph
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an array of integers nums of size n and a positive integer...
transformed-array
transformed-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 an integer array nums that represents a circular array. Yo...
maximum-subarray-sum-with-length-divisible-by-k
maximum-subarray-sum-with-length-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 array of integers nums and an integer k.\n\nReturn the ...
count-beautiful-splits-in-an-array
count-beautiful-splits-in-an-array__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an array nums.\n\nA split of an array nums is beautiful if...
count-subarrays-of-length-three-with-a-condition
count-subarrays-of-length-three-with-a-condition__01__python
Array
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums, return the number of subarrays of length 3 ...
maximum-number-of-distinct-elements-after-operations
maximum-number-of-distinct-elements-after-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 an integer k.\n\nYou are allowed...
maximum-number-of-matching-indices-after-right-shifts
maximum-number-of-matching-indices-after-right-shifts__01__python
Two Pointers
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given two integer arrays, nums1 and nums2, of the same length.\n...
minimum-operations-to-make-columns-strictly-increasing
minimum-operations-to-make-columns-strictly-increasing__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 m x n matrix grid consisting of non-negative integers.\n...
find-the-lexicographically-largest-string-from-the-box-i
find-the-lexicographically-largest-string-from-the-box-i__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 word, and an integer numFriends.\n\nAlice is orga...
find-the-lexicographically-largest-string-from-the-box-ii
find-the-lexicographically-largest-string-from-the-box-ii__01__python
Two Pointers
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a string word, and an integer numFriends.\n\nAlice is orga...
substring-matching-pattern
substring-matching-pattern__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 and a pattern string p, where p contains exactl...
find-mirror-score-of-a-string
find-mirror-score-of-a-string__01__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a string s.\n\nWe define the mirror of a letter in the Eng...
zigzag-grid-traversal-with-skip
zigzag-grid-traversal-with-skip__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 m x n 2D array grid of positive integers.\n\nYour task ...
maximum-amount-of-money-robot-can-earn
maximum-amount-of-money-robot-can-earn__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 m x n grid. A robot starts at the top-left corner of th...
minimum-cost-to-make-arrays-identical
minimum-cost-to-make-arrays-identical__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 arr and brr of length n, and an integer...
maximum-and-minimum-sums-of-at-most-size-k-subarrays
maximum-and-minimum-sums-of-at-most-size-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 and a positive integer k. Return the...
minimum-unlocked-indices-to-sort-nums
minimum-unlocked-indices-to-sort-nums__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 nums consisting of integers between 1 and 3, and ...
count-partitions-with-even-sum-difference
count-partitions-with-even-sum-difference__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\nA partition is defin...
count-mentions-per-user
count-mentions-per-user__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 numberOfUsers representing the total number of ...
permutations-iii
permutations-iii__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\nGiven an integer n, an alternating permutation is a permutation of the f...
reschedule-meetings-for-maximum-free-time-i
reschedule-meetings-for-maximum-free-time-i__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 eventTime denoting the duration of an event, wh...
reschedule-meetings-for-maximum-free-time-i
reschedule-meetings-for-maximum-free-time-i__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\nYou are given an integer eventTime denoting the duration of an event, wh...
maximum-manhattan-distance-after-k-changes
maximum-manhattan-distance-after-k-changes__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 of the characters 'N', 'S', 'E', and...
sort-matrix-by-diagonals
sort-matrix-by-diagonals__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 n x n square matrix of integers grid. Return the matrix...
assign-elements-to-groups-with-constraints
assign-elements-to-groups-with-constraints__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 groups, where groups[i] represents the si...
maximum-students-on-a-single-bench
maximum-students-on-a-single-bench__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 of student data students, where student...
sum-of-good-numbers
sum-of-good-numbers__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 array of integers nums and an integer k, an element nums[i] is ...
separate-squares-ii
separate-squares-ii__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 2D integer array squares. Each squares[i] = [xi, yi, li]...
find-special-substring-of-length-k
find-special-substring-of-length-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 a string s and an integer k.\n\nDetermine if there exists ...
eat-pizzas
eat-pizzas__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 pizzas of size n, where pizzas[i] represe...
length-of-longest-v-shaped-diagonal-segment
length-of-longest-v-shaped-diagonal-segment__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 2D integer matrix grid of size n x m, where each element...
longest-common-prefix-after-at-most-one-removal
longest-common-prefix-after-at-most-one-removal__01__python
Two Pointers
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given two strings s and t.\n\nReturn the length of the longest c...
check-if-digits-are-equal-in-string-after-operations-i
check-if-digits-are-equal-in-string-after-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 digits. Perform the following ope...
transform-array-by-parity
transform-array-by-parity__01__python
Sorting
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums. Transform nums by performing the fo...
find-the-largest-almost-missing-integer
find-the-largest-almost-missing-integer__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\nAn integer x is...
longest-palindromic-subsequence-after-at-most-k-operations
longest-palindromic-subsequence-after-at-most-k-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 a string s and an integer k.\n\nIn one operation, you can ...
fruits-into-baskets-ii
fruits-into-baskets-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 two arrays of integers, fruits and baskets, each of length...
fruits-into-baskets-iii
fruits-into-baskets-iii__01__python
Binary Search
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given two arrays of integers, fruits and baskets, each of length...
maximize-subarrays-after-removing-one-conflicting-pair
maximize-subarrays-after-removing-one-conflicting-pair__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 n which represents an array nums containing the...
apply-substitutions
apply-substitutions__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 replacements mapping and a text string that may contain ...
unique-3-digit-even-numbers
unique-3-digit-even-numbers__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 digits called digits. Your task is to determin...
maximum-unique-subarray-sum-after-deletion
maximum-unique-subarray-sum-after-deletion__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\nYou are allowed to delete any nu...
closest-equal-element-queries
closest-equal-element-queries__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 circular array nums and an array queries.\n\nFor each qu...
phone-number-prefix
phone-number-prefix__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 array numbers that represents phone numbers. Retu...
properties-graph
properties-graph__01__python
DFS
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 2D integer array properties having dimensions n x m and ...
find-the-minimum-amount-of-time-to-brew-potions
find-the-minimum-amount-of-time-to-brew-potions__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 integer arrays, skill and mana, of length n and m, res...
minimum-operations-to-make-array-elements-zero
minimum-operations-to-make-array-elements-zero__01__python
Bit Manipulation
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 2D array queries, where queries[i] is of the form [l, r]...
reverse-degree-of-a-string
reverse-degree-of-a-string__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a string s, calculate its reverse degree.\n\nThe reverse degree is...
maximize-active-section-with-trade-i
maximize-active-section-with-trade-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 a binary string s of length n, where:\n\n\t'1' represents ...
minimum-cost-to-reach-every-position
minimum-cost-to-reach-every-position__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 cost of size n. You are currently at posi...
longest-palindrome-after-substring-concatenation-i
longest-palindrome-after-substring-concatenation-i__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, s and t.\n\nYou can create a new string by se...
longest-palindrome-after-substring-concatenation-ii
longest-palindrome-after-substring-concatenation-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 two strings, s and t.\n\nYou can create a new string by se...
minimum-pair-removal-to-sort-array-i
minimum-pair-removal-to-sort-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\nGiven an array nums, you can perform the following operation any number ...
make-a-positive-array
make-a-positive-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 array nums. An array is considered positive if the sum ...
minimum-operations-to-make-array-sum-divisible-by-k
minimum-operations-to-make-array-sum-divisible-by-k__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums and an integer k. You can perform th...
find-closest-person
find-closest-person__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 x, y, and z, representing the positions of ...
calculate-score-after-performing-instructions
calculate-score-after-performing-instructions__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 arrays, instructions and values, both of size n.\n\nYo...
make-array-non-decreasing
make-array-non-decreasing__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. In one operation, you can select a ...
find-the-most-common-response
find-the-most-common-response__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 string array responses where each responses[i] is an ...
unit-conversion-i
unit-conversion-i__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\nThere are n types of units indexed from 0 to n - 1. You are given a 2D i...
find-most-frequent-vowel-and-consonant
find-most-frequent-vowel-and-consonant__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 ('a' to...
minimum-operations-to-convert-all-elements-to-zero
minimum-operations-to-convert-all-elements-to-zero__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 size n, consisting of non-negative intege...
minimum-deletions-for-at-most-k-distinct-characters
minimum-deletions-for-at-most-k-distinct-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 consisting of lowercase English letters, and an...
equal-sum-grid-partition-i
equal-sum-grid-partition-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 m x n matrix grid of positive integers. Your task is to...
multiply-two-polynomials
multiply-two-polynomials__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 integer arrays poly1 and poly2, where the element at i...
smallest-index-with-digit-sum-equal-to-index
smallest-index-with-digit-sum-equal-to-index__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\nReturn the smallest index i such...
minimum-swaps-to-sort-by-digit-sum
minimum-swaps-to-sort-by-digit-sum__01__python
Sorting
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an array nums of distinct positive integers. You need to s...
smallest-subarray-to-sort-in-every-sliding-window
smallest-subarray-to-sort-in-every-sliding-window__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums and an integer k.\n\nFor each contig...
find-minimum-log-transportation-cost
find-minimum-log-transportation-cost__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 integers n, m, and k.\n\nThere are two logs of lengths n a...
resulting-string-after-adjacent-removals
resulting-string-after-adjacent-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 of lowercase English letters.\n\nYou...
partition-array-into-two-equal-product-subsets
partition-array-into-two-equal-product-subsets__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 containing distinct positive integer...
minimum-moves-to-clean-the-classroom
minimum-moves-to-clean-the-classroom__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 m x n grid classroom where a student volunteer is taske...
find-the-shortest-superstring-ii
find-the-shortest-superstring-ii__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 strings, s1 and s2. Return the shortest possible strin...
maximize-ysum-by-picking-a-triplet-of-distinct-xvalues
maximize-ysum-by-picking-a-triplet-of-distinct-xvalues__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 x and y, each of length n. You must cho...
best-time-to-buy-and-sell-stock-v
best-time-to-buy-and-sell-stock-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 given an integer array prices where prices[i] is the price of a ...
transform-array-to-all-equal-elements
transform-array-to-all-equal-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 of size n containing only 1 and -1, ...
count-the-number-of-computer-unlocking-permutations
count-the-number-of-computer-unlocking-permutations__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 complexity of length n.\n\nThere are n locked com...