slug
stringlengths
4
77
solution_id
stringlengths
16
89
primary_algorithm
stringclasses
22 values
verified
bool
1 class
messages
listlengths
3
3
valid-permutations-for-di-sequence
valid-permutations-for-di-sequence__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 of length n where s[i] is either:\n\n\t'D' mean...
fruit-into-baskets
fruit-into-baskets__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 visiting a farm that has a single row of fruit trees arranged fr...
fruit-into-baskets
fruit-into-baskets__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 visiting a farm that has a single row of fruit trees arranged fr...
sum-of-subarray-minimums
sum-of-subarray-minimums__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an array of integers arr, find the sum of min(b), where b ranges o...
smallest-range-i
smallest-range-i__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums and an integer k.\n\nIn one operatio...
snakes-and-ladders
snakes-and-ladders__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 n x n integer matrix board where the cells are labeled ...
smallest-range-ii
smallest-range-ii__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums and an integer k.\n\nFor each index ...
sort-an-array
sort-an-array__02__python
Divide and Conquer
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an array of integers nums, sort the array in ascending order and r...
cat-and-mouse
cat-and-mouse__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 game on an undirected graph is played by two players, Mouse and Cat, w...
partition-array-into-disjoint-intervals
partition-array-into-disjoint-intervals__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, partition it into two (contiguous) subarray...
word-subsets
word-subsets__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 string arrays words1 and words2.\n\nA string b is a su...
reverse-only-letters
reverse-only-letters__01__python
Two Pointers
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a string s, reverse the string according to the following rules:\n...
maximum-sum-circular-subarray
maximum-sum-circular-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\nGiven a circular integer array nums of length n, return the maximum poss...
number-of-music-playlists
number-of-music-playlists__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\nYour music player contains n different songs. You want to listen to goal...
number-of-music-playlists
number-of-music-playlists__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\nYour music player contains n different songs. You want to listen to goal...
minimum-add-to-make-parentheses-valid
minimum-add-to-make-parentheses-valid__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nA parentheses string is valid if and only if:\n\n\tIt is the empty strin...
minimum-add-to-make-parentheses-valid
minimum-add-to-make-parentheses-valid__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\nA parentheses string is valid if and only if:\n\n\tIt is the empty strin...
sort-array-by-parity-ii
sort-array-by-parity-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\nGiven an array of integers nums, half of the integers in nums are odd, a...
minimize-malware-spread
minimize-malware-spread__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 network of n nodes represented as an n x n adjacency mat...
flip-string-to-monotone-increasing
flip-string-to-monotone-increasing__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nA binary string is monotone increasing if it consists of some number of ...
three-equal-parts
three-equal-parts__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 arr which consists of only zeros and ones, divide...
minimize-malware-spread-ii
minimize-malware-spread-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\nYou are given a network of n nodes represented as an n x n adjacency mat...
unique-email-addresses
unique-email-addresses__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\nEvery valid email consists of a local name and a domain name, separated ...
binary-subarrays-with-sum
binary-subarrays-with-sum__01__python
Sliding Window
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a binary array nums and an integer goal, return the number of non-...
binary-subarrays-with-sum
binary-subarrays-with-sum__02__python
Sliding Window
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a binary array nums and an integer goal, return the number of non-...
minimum-falling-path-sum
minimum-falling-path-sum__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an n x n array of integers matrix, return the minimum sum of any f...
knight-dialer
knight-dialer__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 chess knight has a unique movement, it may move two squares vertical...
knight-dialer
knight-dialer__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 chess knight has a unique movement, it may move two squares vertical...
reorder-data-in-log-files
reorder-data-in-log-files__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 of logs. Each log is a space-delimited string of ...
range-sum-of-bst
range-sum-of-bst__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 node of a binary search tree and two integers low and hig...
minimum-area-rectangle
minimum-area-rectangle__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 of points in the X-Y plane points where points[i]...
distinct-subsequences-ii
distinct-subsequences-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\nGiven a string s, return the number of distinct non-empty subsequences o...
distinct-subsequences-ii
distinct-subsequences-ii__02__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a string s, return the number of distinct non-empty subsequences o...
distinct-subsequences-ii
distinct-subsequences-ii__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\nGiven a string s, return the number of distinct non-empty subsequences o...
valid-mountain-array
valid-mountain-array__01__python
Two Pointers
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an array of integers arr, return true if and only if it is a valid...
di-string-match
di-string-match__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nA permutation perm of n + 1 integers of all the integers in the range [0...
delete-columns-to-make-sorted
delete-columns-to-make-sorted__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 of n strings strs, all of the same length.\n\nThe...
minimum-increment-to-make-array-unique
minimum-increment-to-make-array-unique__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 move, you can pick an index ...
minimum-increment-to-make-array-unique
minimum-increment-to-make-array-unique__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 an integer array nums. In one move, you can pick an index ...
validate-stack-sequences
validate-stack-sequences__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 two integer arrays pushed and popped each with distinct values, re...
most-stones-removed-with-same-row-or-column
most-stones-removed-with-same-row-or-column__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\nOn a 2D plane, we place n stones at some integer coordinate points. Each...
most-stones-removed-with-same-row-or-column
most-stones-removed-with-same-row-or-column__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\nOn a 2D plane, we place n stones at some integer coordinate points. Each...
largest-time-for-given-digits
largest-time-for-given-digits__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 array arr of 4 digits, find the latest 24-hour time that can be...
largest-time-for-given-digits
largest-time-for-given-digits__02__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 array arr of 4 digits, find the latest 24-hour time that can be...
reveal-cards-in-increasing-order
reveal-cards-in-increasing-order__01__python
Sorting
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array deck. There is a deck of cards where ever...
largest-component-size-by-common-factor
largest-component-size-by-common-factor__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 integer array of unique positive integers nums. Conside...
array-of-doubled-pairs
array-of-doubled-pairs__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an integer array of even length arr, return true if it is possible...
delete-columns-to-make-sorted-ii
delete-columns-to-make-sorted-ii__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an array of n strings strs, all of the same length.\n\nWe ...
tallest-billboard
tallest-billboard__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 installing a billboard and want it to have the largest height. T...
tallest-billboard
tallest-billboard__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 installing a billboard and want it to have the largest height. T...
check-completeness-of-a-binary-tree
check-completeness-of-a-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\nGiven the root of a binary tree, determine if it is a complete binary tr...
delete-columns-to-make-sorted-iii
delete-columns-to-make-sorted-iii__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an array of n strings strs, all of the same length.\n\nWe ...
n-repeated-element-in-size-2n-array
n-repeated-element-in-size-2n-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 with the following properties:\n\n\t...
n-repeated-element-in-size-2n-array
n-repeated-element-in-size-2n-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 integer array nums with the following properties:\n\n\t...
maximum-width-ramp
maximum-width-ramp__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\nA ramp in an integer array nums is a pair (i, j) for which i < j and num...
least-operators-to-express-number
least-operators-to-express-number__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\nGiven a single positive integer x, we will write an expression of the fo...
univalued-binary-tree
univalued-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\nA binary tree is uni-valued if every node in the tree has the same value...
vowel-spellchecker
vowel-spellchecker__01__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a wordlist, we want to implement a spellchecker that converts a qu...
binary-tree-cameras
binary-tree-cameras__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 the root of a binary tree. We install cameras on the tree ...
powerful-integers
powerful-integers__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 three integers x, y, and bound, return a list of all the powerful ...
k-closest-points-to-origin
k-closest-points-to-origin__03__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 of points where points[i] = [xi, yi] represents a point o...
subarray-sums-divisible-by-k
subarray-sums-divisible-by-k__01__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums and an integer k, return the number of non-e...
largest-perimeter-triangle
largest-perimeter-triangle__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums, return the largest perimeter of a triangle ...
squares-of-a-sorted-array
squares-of-a-sorted-array__01__python
Two Pointers
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums sorted in non-decreasing order, return an ar...
triples-with-bitwise-and-equal-to-zero
triples-with-bitwise-and-equal-to-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\nGiven an integer array nums, return the number of AND triples.\n\nAn AND...
minimum-cost-for-tickets
minimum-cost-for-tickets__02__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou have planned some train traveling one year in advance. The days of t...
sum-of-even-numbers-after-queries
sum-of-even-numbers-after-queries__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 array queries where queries[i...
interval-list-intersections
interval-list-intersections__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 lists of closed intervals, firstList and secondList, w...
vertical-order-traversal-of-a-binary-tree
vertical-order-traversal-of-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, calculate the vertical order traversal ...
smallest-string-starting-from-leaf
smallest-string-starting-from-leaf__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 the root of a binary tree where each node has a value in t...
add-to-array-form-of-integer
add-to-array-form-of-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\nThe array-form of an integer num is an array representing its digits in ...
satisfiability-of-equality-equations
satisfiability-of-equality-equations__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 strings equations that represent relationships...
broken-calculator
broken-calculator__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 broken calculator that has the integer startValue on its disp...
subarrays-with-k-different-integers
subarrays-with-k-different-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\nGiven an integer array nums and an integer k, return the number of good ...
cousins-in-binary-tree
cousins-in-binary-tree__01__python
DFS
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven the root of a binary tree with unique values and the values of two...
cousins-in-binary-tree
cousins-in-binary-tree__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\nGiven the root of a binary tree with unique values and the values of two...
minimum-number-of-k-consecutive-bit-flips
minimum-number-of-k-consecutive-bit-flips__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 binary array nums and an integer k.\n\nA k-bit flip is c...
minimum-number-of-k-consecutive-bit-flips
minimum-number-of-k-consecutive-bit-flips__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 a binary array nums and an integer k.\n\nA k-bit flip is c...
find-the-town-judge
find-the-town-judge__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\nIn a town, there are n people labeled from 1 to n. There is a rumor that...
grid-illumination
grid-illumination__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 2D grid of size n x n where each cell of this grid has a lamp...
find-common-characters
find-common-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\nGiven a string array words, return an array of all characters that show ...
check-if-word-is-valid-after-substitutions
check-if-word-is-valid-after-substitutions__01__python
String
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a string s, determine if it is valid.\n\nA string s is valid if, s...
max-consecutive-ones-iii
max-consecutive-ones-iii__01__python
Sliding Window
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a binary array nums and an integer k, return the maximum number of...
maximize-sum-of-array-after-k-negations
maximize-sum-of-array-after-k-negations__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums and an integer k, modify the array in the fo...
clumsy-factorial
clumsy-factorial__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\nThe factorial of a positive integer n is the product of all positive int...
minimum-domino-rotations-for-equal-row
minimum-domino-rotations-for-equal-row__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\nIn a row of dominoes, tops[i] and bottoms[i] represent the top and botto...
complement-of-base-10-integer
complement-of-base-10-integer__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\nThe complement of an integer is the integer you get when you flip all th...
pairs-of-songs-with-total-durations-divisible-by-60
pairs-of-songs-with-total-durations-divisible-by-60__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 list of songs where the ith song has a duration of time[...
numbers-with-repeated-digits
numbers-with-repeated-digits__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an integer n, return the number of positive integers in the range ...
best-sightseeing-pair
best-sightseeing-pair__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 values where values[i] represents the val...
smallest-integer-divisible-by-k
smallest-integer-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\nGiven a positive integer k, you need to find the length of the smallest ...
binary-string-with-substrings-representing-1-to-n
binary-string-with-substrings-representing-1-to-n__01__python
Sliding Window
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a binary string s and a positive integer n, return true if the bin...
next-greater-node-in-linked-list
next-greater-node-in-linked-list__01__python
Linked List
true
[ { "role": "system", "content": "You are a competitive 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 with n nodes.\n\nFor each node i...
remove-outermost-parentheses
remove-outermost-parentheses__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\nA valid parentheses string is either empty \"\", \"(\" + A + \")\", or A...
remove-outermost-parentheses
remove-outermost-parentheses__02__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\nA valid parentheses string is either empty \"\", \"(\" + A + \")\", or A...
video-stitching
video-stitching__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 series of video clips from a sporting event that lasted ...
divisor-game
divisor-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 take turns playing a game, with Alice starting first.\n\nI...
moving-stones-until-consecutive
moving-stones-until-consecutive__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 three stones in different positions on the X-axis. You are giv...
uncrossed-lines
uncrossed-lines__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 nums1 and nums2. We write the integers ...
valid-boomerang
valid-boomerang__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 points where points[i] = [xi, yi] represents a point on t...