slug
stringlengths
4
77
solution_id
stringlengths
16
89
primary_algorithm
stringclasses
22 values
verified
bool
1 class
messages
listlengths
3
3
construct-the-lexicographically-largest-valid-sequence
construct-the-lexicographically-largest-valid-sequence__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, find a sequence with elements in the range [1, n] th...
number-of-ways-to-reconstruct-a-tree
number-of-ways-to-reconstruct-a-tree__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 pairs, where pairs[i] = [xi, yi], and:\n\n\tThere...
decode-xored-array
decode-xored-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\nThere is a hidden integer array arr that consists of n non-negative inte...
swapping-nodes-in-a-linked-list
swapping-nodes-in-a-linked-list__01__python
Two Pointers
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given the head of a linked list, and an integer k.\n\nReturn the...
minimize-hamming-distance-after-swap-operations
minimize-hamming-distance-after-swap-operations__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, source and target, both of length n. Y...
find-minimum-time-to-finish-all-jobs
find-minimum-time-to-finish-all-jobs__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 jobs, where jobs[i] is the amount of time...
number-of-rectangles-that-can-form-the-largest-square
number-of-rectangles-that-can-form-the-largest-square__01__python
Array
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an array rectangles where rectangles[i] = [li, wi] represe...
tuple-with-same-product
tuple-with-same-product__01__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an array nums of distinct positive integers, return the number of ...
largest-submatrix-with-rearrangements
largest-submatrix-with-rearrangements__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 binary matrix matrix of size m x n, and you are allowed ...
minimum-number-of-people-to-teach
minimum-number-of-people-to-teach__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\nOn a social network consisting of m users and some friendships between u...
decode-xored-permutation
decode-xored-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\nThere is an integer array perm that is a permutation of the first n posi...
latest-time-by-replacing-hidden-digits
latest-time-by-replacing-hidden-digits__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a string time in the form of hh:mm, where some of the dig...
change-minimum-characters-to-satisfy-one-of-three-conditions
change-minimum-characters-to-satisfy-one-of-three-conditions__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 a and b that consist of lowercase letters. In ...
find-distance-in-a-binary-tree
find-distance-in-a-binary-tree__01__python
DFS
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven the root of a binary tree and two integers p and q, return the dis...
maximum-number-of-balls-in-a-box
maximum-number-of-balls-in-a-box__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 working in a ball factory where you have n balls numbered from l...
restore-the-array-from-adjacent-pairs
restore-the-array-from-adjacent-pairs__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 is an integer array nums that consists of n unique elements, but y...
restore-the-array-from-adjacent-pairs
restore-the-array-from-adjacent-pairs__02__python
DFS
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nThere is an integer array nums that consists of n unique elements, but y...
maximum-subarray-sum-after-one-operation
maximum-subarray-sum-after-one-operation__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. You must perform exactly one operat...
sum-of-unique-elements
sum-of-unique-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. The unique elements of an array are...
maximum-absolute-sum-of-any-subarray
maximum-absolute-sum-of-any-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 integer array nums. The absolute sum of a subarray [num...
check-if-array-is-sorted-and-rotated
check-if-array-is-sorted-and-rotated__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, return true if the array was originally sorted in n...
maximum-score-from-removing-stones
maximum-score-from-removing-stones__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are playing a solitaire game with three piles of stones of sizes a​​...
maximum-score-from-removing-stones
maximum-score-from-removing-stones__02__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are playing a solitaire game with three piles of stones of sizes a​​...
largest-merge-of-two-strings
largest-merge-of-two-strings__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 strings word1 and word2. You want to construct a strin...
minimum-changes-to-make-alternating-binary-string
minimum-changes-to-make-alternating-binary-string__01__python
String
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a string s consisting only of the characters '0' and '1'. ...
count-number-of-homogenous-substrings
count-number-of-homogenous-substrings__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, return the number of homogenous substrings of s. Since...
buildings-with-an-ocean-view
buildings-with-an-ocean-view__01__python
Array
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nThere are n buildings in a line. You are given an integer array heights ...
minimum-number-of-operations-to-move-all-balls-to-each-box
minimum-number-of-operations-to-move-all-balls-to-each-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 have n boxes. You are given a binary string boxes of length n, where...
minimum-number-of-operations-to-move-all-balls-to-each-box
minimum-number-of-operations-to-move-all-balls-to-each-box__02__python
Array
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou have n boxes. You are given a binary string boxes of length n, where...
maximize-palindrome-length-from-subsequences
maximize-palindrome-length-from-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 two strings, word1 and word2. You want to construct a stri...
sort-features-by-popularity
sort-features-by-popularity__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 features where features[i] is a single word...
count-items-matching-a-rule
count-items-matching-a-rule__01__python
Array
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an array items, where each items[i] = [typei, colori, name...
equal-sum-arrays-with-minimum-number-of-operations
equal-sum-arrays-with-minimum-number-of-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 two arrays of integers nums1 and nums2, possibly of differ...
equal-sum-arrays-with-minimum-number-of-operations
equal-sum-arrays-with-minimum-number-of-operations__02__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given two arrays of integers nums1 and nums2, possibly of differ...
car-fleet-ii
car-fleet-ii__01__python
Heap
true
[ { "role": "system", "content": "You 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 cars traveling at different speeds in the same direction alo...
find-nearest-point-that-has-the-same-x-or-y-coordinate
find-nearest-point-that-has-the-same-x-or-y-coordinate__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 integers, x and y, which represent your current locati...
check-if-number-is-a-sum-of-powers-of-three
check-if-number-is-a-sum-of-powers-of-three__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an integer n, return true if it is possible to represent n as the ...
minimum-elements-to-add-to-form-a-given-sum
minimum-elements-to-add-to-form-a-given-sum__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums and two integers limit and goal. The...
maximize-the-beauty-of-the-garden
maximize-the-beauty-of-the-garden__01__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nThere is a garden of n flowers, and each flower has an integer beauty va...
check-if-one-string-swap-can-make-strings-equal
check-if-one-string-swap-can-make-strings-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 two strings s1 and s2 of equal length. A string swap is an...
find-center-of-star-graph
find-center-of-star-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\nThere is an undirected star graph consisting of n nodes labeled from 1 t...
maximum-score-of-a-good-subarray
maximum-score-of-a-good-subarray__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 array of integers nums (0-indexed) and an integer k.\n\...
maximum-score-of-a-good-subarray
maximum-score-of-a-good-subarray__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 array of integers nums (0-indexed) and an integer k.\n\...
count-pairs-of-equal-substrings-with-minimum-difference
count-pairs-of-equal-substrings-with-minimum-difference__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 strings firstString and secondString that are 0-indexe...
second-largest-digit-in-a-string
second-largest-digit-in-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\nGiven an alphanumeric string s, return the second largest numerical digi...
maximum-value-at-a-given-index-in-a-bounded-array
maximum-value-at-a-given-index-in-a-bounded-array__01__python
Binary Search
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given three positive integers: n, index, and maxSum. You want to...
count-pairs-with-xor-in-a-range
count-pairs-with-xor-in-a-range__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\nGiven a (0-indexed) integer array nums and two integers low and high, re...
minimum-number-of-operations-to-reinitialize-a-permutation
minimum-number-of-operations-to-reinitialize-a-permutation__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 even integer n​​​​​​. You initially have a permutation ...
evaluate-the-bracket-pairs-of-a-string
evaluate-the-bracket-pairs-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\nYou are given a string s that contains some bracket pairs, with each pai...
maximize-number-of-nice-divisors
maximize-number-of-nice-divisors__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 primeFactors. You are asked to construc...
determine-color-of-a-chessboard-square
determine-color-of-a-chessboard-square__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 coordinates, a string that represents the coordinates of a...
sentence-similarity-iii
sentence-similarity-iii__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 sentence1 and sentence2, each representing a s...
count-nice-pairs-in-an-array
count-nice-pairs-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 array nums that consists of non-negative integers. Let ...
count-nice-pairs-in-an-array
count-nice-pairs-in-an-array__02__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an array nums that consists of non-negative integers. Let ...
maximum-number-of-groups-getting-fresh-donuts
maximum-number-of-groups-getting-fresh-donuts__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nThere is a donuts shop that bakes donuts in batches of batchSize. They h...
maximum-number-of-groups-getting-fresh-donuts
maximum-number-of-groups-getting-fresh-donuts__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\nThere is a donuts shop that bakes donuts in batches of batchSize. They h...
truncate-sentence
truncate-sentence__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nA sentence is a list of words that are separated by a single space with ...
truncate-sentence
truncate-sentence__02__python
Array
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nA sentence is a list of words that are separated by a single space with ...
finding-the-users-active-minutes
finding-the-users-active-minutes__01__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given the logs for users' actions on LeetCode, and an integer k....
sign-of-the-product-of-an-array
sign-of-the-product-of-an-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\nImplement a function signFunc(x) that returns:\n\n\t1 if x is positive.\...
find-the-winner-of-the-circular-game
find-the-winner-of-the-circular-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\nThere are n friends that are playing a game. The friends are sitting in ...
minimum-sideway-jumps
minimum-sideway-jumps__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 3 lane road of length n that consists of n + 1 points labeled...
minimum-operations-to-make-the-array-increasing
minimum-operations-to-make-the-array-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 an integer array nums (0-indexed). In one operation, you c...
minimum-number-of-operations-to-make-string-sorted
minimum-number-of-operations-to-make-string-sorted__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 (0-indexed)​​​​​​. You are asked to perform the...
check-if-the-sentence-is-pangram
check-if-the-sentence-is-pangram__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\nA pangram is a sentence where every letter of the English alphabet appea...
check-if-the-sentence-is-pangram
check-if-the-sentence-is-pangram__02__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\nA pangram is a sentence where every letter of the English alphabet appea...
maximum-building-height
maximum-building-height__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 want to build n new buildings in a city. The new buildings will be b...
next-palindrome-using-same-digits
next-palindrome-using-same-digits__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 numeric string num, representing a very large palindrome...
maximum-element-after-decreasing-and-rearranging
maximum-element-after-decreasing-and-rearranging__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an array of positive integers arr. Perform some operations...
minimum-distance-to-the-target-element
minimum-distance-to-the-target-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\nGiven an integer array nums (0-indexed) and two integers target and star...
splitting-a-string-into-descending-consecutive-values
splitting-a-string-into-descending-consecutive-values__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 string s that consists of only digits.\n\nCheck if we ca...
minimum-adjacent-swaps-to-reach-the-kth-smallest-number
minimum-adjacent-swaps-to-reach-the-kth-smallest-number__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a string num, representing a large integer, and an integer...
maximum-population-year
maximum-population-year__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 logs where each logs[i] = [birthi, deat...
maximum-distance-between-a-pair-of-values
maximum-distance-between-a-pair-of-values__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 two non-increasing 0-indexed integer arrays nums1​​​​​​ an...
longest-word-with-all-prefixes
longest-word-with-all-prefixes__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\nGiven an array of strings words, find the longest string in words such t...
sorting-the-sentence
sorting-the-sentence__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\nA sentence is a list of words that are separated by a single space with ...
incremental-memory-leak
incremental-memory-leak__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 memory1 and memory2 representing the availabl...
sum-of-floored-pairs
sum-of-floored-pairs__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 integer array nums, return the sum of floor(nums[i] / nums[j]) ...
minimum-number-of-swaps-to-make-the-binary-string-alternating
minimum-number-of-swaps-to-make-the-binary-string-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\nGiven a binary string s, return the minimum number of character swaps to...
number-of-ways-to-rearrange-sticks-with-k-sticks-visible
number-of-ways-to-rearrange-sticks-with-k-sticks-visible__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nThere are n uniquely-sized sticks whose lengths are integers from 1 to n...
number-of-ways-to-rearrange-sticks-with-k-sticks-visible
number-of-ways-to-rearrange-sticks-with-k-sticks-visible__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\nThere are n uniquely-sized sticks whose lengths are integers from 1 to n...
product-of-two-run-length-encoded-arrays
product-of-two-run-length-encoded-arrays__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\nRun-length encoding is a compression algorithm that allows for an intege...
longer-contiguous-segments-of-ones-than-zeros
longer-contiguous-segments-of-ones-than-zeros__01__python
String
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a binary string s, return true if the longest contiguous segment o...
jump-game-vii
jump-game-vii__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed binary string s and two integers minJump and m...
substrings-of-size-three-with-distinct-characters
substrings-of-size-three-with-distinct-characters__01__python
Sliding Window
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nA string is good if there are no repeated characters.\n\nGiven a string ...
minimize-maximum-pair-sum-in-array
minimize-maximum-pair-sum-in-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\nThe pair sum of a pair (a,b) is equal to a + b. The maximum pair sum is ...
check-if-word-equals-summation-of-two-words
check-if-word-equals-summation-of-two-words__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\nThe letter value of a letter is its position in the alphabet starting fr...
maximum-value-after-insertion
maximum-value-after-insertion__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 very large integer n, represented as a string,​​​​​​ and...
egg-drop-with-2-eggs-and-n-floors
egg-drop-with-2-eggs-and-n-floors__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 identical eggs and you have access to a building with ...
cutting-ribbons
cutting-ribbons__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 ribbons, where ribbons[i] represents the ...
check-if-all-the-integers-in-a-range-are-covered
check-if-all-the-integers-in-a-range-are-covered__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 ranges and two integers left and right....
largest-magic-square
largest-magic-square__01__python
Array
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nA k x k magic square is a k x k grid filled with integers such that ever...
redistribute-characters-to-make-all-strings-equal
redistribute-characters-to-make-all-strings-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 an array of strings words (0-indexed).\n\nIn one operation...
largest-odd-number-in-string
largest-odd-number-in-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 num, representing a large integer. Return the lar...
the-number-of-full-rounds-you-have-played
the-number-of-full-rounds-you-have-played__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 participating in an online chess tournament. There is a chess ro...
game-of-nim
game-of-nim__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\nAlice and Bob take turns playing a game with Alice starting first.\n\nIn...
remove-one-element-to-make-the-array-strictly-increasing
remove-one-element-to-make-the-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\nGiven a 0-indexed integer array nums, return true if it can be made stri...
maximum-alternating-subsequence-sum
maximum-alternating-subsequence-sum__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nThe alternating sum of a 0-indexed array is defined as the sum of the el...
maximum-alternating-subsequence-sum
maximum-alternating-subsequence-sum__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\nThe alternating sum of a 0-indexed array is defined as the sum of the el...
maximum-product-difference-between-two-pairs
maximum-product-difference-between-two-pairs__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\nThe product difference between two pairs (a, b) and (c, d) is defined as...