slug
stringlengths
4
77
solution_id
stringlengths
16
89
primary_algorithm
stringclasses
22 values
verified
bool
1 class
messages
listlengths
3
3
missing-number-in-arithmetic-progression
missing-number-in-arithmetic-progression__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\nIn some array arr, the values were in arithmetic progression: the values...
missing-number-in-arithmetic-progression
missing-number-in-arithmetic-progression__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\nIn some array arr, the values were in arithmetic progression: the values...
meeting-scheduler
meeting-scheduler__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 the availability time slots arrays slots1 and slots2 of two people...
toss-strange-coins
toss-strange-coins__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 have some coins. The i-th coin has a probability prob[i] of facing ...
toss-strange-coins
toss-strange-coins__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 some coins. The i-th coin has a probability prob[i] of facing ...
remove-sub-folders-from-the-filesystem
remove-sub-folders-from-the-filesystem__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\nGiven a list of folders folder, return the folders after removing all su...
remove-sub-folders-from-the-filesystem
remove-sub-folders-from-the-filesystem__02__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 list of folders folder, return the folders after removing all su...
replace-the-substring-for-balanced-string
replace-the-substring-for-balanced-string__01__python
Two Pointers
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a string s of length n containing only four kinds of chara...
circular-permutation-in-binary-representation
circular-permutation-in-binary-representation__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 2 integers n and start. Your task is return any permutation p of (...
maximum-length-of-a-concatenated-string-with-unique-characters
maximum-length-of-a-concatenated-string-with-unique-characters__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 array of strings arr. A string s is formed by the conca...
tree-diameter
tree-diameter__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\nThe diameter of a tree is the number of edges in the longest path in tha...
minimum-swaps-to-make-strings-equal
minimum-swaps-to-make-strings-equal__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given two strings s1 and s2 of equal length consisting of letter...
count-number-of-nice-subarrays
count-number-of-nice-subarrays__01__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an array of integers nums and an integer k. A continuous subarray ...
minimum-remove-to-make-valid-parentheses
minimum-remove-to-make-valid-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\nGiven a string s of '(' , ')' and lowercase English characters.\n\nYour ...
cells-with-odd-values-in-a-matrix
cells-with-odd-values-in-a-matrix__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nThere is an m x n matrix that is initialized to all 0's. There is also a...
cells-with-odd-values-in-a-matrix
cells-with-odd-values-in-a-matrix__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\nThere is an m x n matrix that is initialized to all 0's. There is also a...
cells-with-odd-values-in-a-matrix
cells-with-odd-values-in-a-matrix__03__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nThere is an m x n matrix that is initialized to all 0's. There is also a...
number-of-closed-islands
number-of-closed-islands__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 a 2D grid consists of 0s (land) and 1s (water). An island is a ma...
maximum-score-words-formed-by-letters
maximum-score-words-formed-by-letters__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 list of words, list of single letters (might be repeating) and ...
encode-number
encode-number__01__python
Bit Manipulation
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a non-negative integer num, Return its encoding string.\n\nThe enc...
smallest-common-region
smallest-common-region__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 some lists of regions where the first region of each list ...
handshakes-that-dont-cross
handshakes-that-dont-cross__01__python
Memoization
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an even number of people numPeople that stand around a cir...
shift-2d-grid
shift-2d-grid__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 2D grid of size m x n and an integer k. You need to shift the gr...
greatest-sum-divisible-by-three
greatest-sum-divisible-by-three__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 array nums, return the maximum possible sum of elements...
greatest-sum-divisible-by-three
greatest-sum-divisible-by-three__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 an integer array nums, return the maximum possible sum of elements...
search-suggestions-system
search-suggestions-system__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 strings products and a string searchWord.\n\nD...
remove-interval
remove-interval__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 set of real numbers can be represented as the union of several disjoin...
find-winner-on-a-tic-tac-toe-game
find-winner-on-a-tic-tac-toe-game__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\nTic-tac-toe is played by two players A and B on a 3 x 3 grid. The rules ...
count-square-submatrices-with-all-ones
count-square-submatrices-with-all-ones__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 m * n matrix of ones and zeros, return how many square submatric...
palindrome-partitioning-iii
palindrome-partitioning-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 a string s containing lowercase letters and an integer k. ...
minimum-number-of-flips-to-convert-binary-matrix-to-zero-matrix
minimum-number-of-flips-to-convert-binary-matrix-to-zero-matrix__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 a m x n binary matrix mat. In one step, you can choose one cell an...
element-appearing-more-than-25-in-sorted-array
element-appearing-more-than-25-in-sorted-array__01__python
Array
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an integer array sorted in non-decreasing order, there is exactly ...
remove-covered-intervals
remove-covered-intervals__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\nGiven an array intervals where intervals[i] = [li, ri] represent the int...
minimum-falling-path-sum-ii
minimum-falling-path-sum-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 an n x n integer matrix grid, return the minimum sum of a falling ...
convert-binary-number-in-a-linked-list-to-integer
convert-binary-number-in-a-linked-list-to-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\nGiven head which is a reference node to a singly-linked list. The value ...
sequential-digits
sequential-digits__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\nAn integer has sequential digits if and only if each digit in the number...
maximum-side-length-of-a-square-with-sum-less-than-or-equal-to-threshold
maximum-side-length-of-a-square-with-sum-less-than-or-equal-to-threshold__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 m x n matrix mat and an integer threshold, return the maximum si...
shortest-path-in-a-grid-with-obstacles-elimination
shortest-path-in-a-grid-with-obstacles-elimination__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 integer matrix grid where each cell is either 0 (...
divide-array-in-sets-of-k-consecutive-numbers
divide-array-in-sets-of-k-consecutive-numbers__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\nGiven an array of integers nums and a positive integer k, check whether ...
maximum-number-of-occurrences-of-a-substring
maximum-number-of-occurrences-of-a-substring__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 s, return the maximum number of occurrences of any substr...
maximum-candies-you-can-get-from-boxes
maximum-candies-you-can-get-from-boxes__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 have n boxes labeled from 0 to n - 1. You are given four arrays: sta...
replace-elements-with-greatest-element-on-right-side
replace-elements-with-greatest-element-on-right-side__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 arr, replace every element in that array with the greates...
number-of-paths-with-max-score
number-of-paths-with-max-score__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 square board of characters. You can move on the board st...
deepest-leaves-sum
deepest-leaves-sum__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, return the sum of values of its deepest...
deepest-leaves-sum
deepest-leaves-sum__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, return the sum of values of its deepest...
all-elements-in-two-binary-search-trees
all-elements-in-two-binary-search-trees__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 two binary search trees root1 and root2, return a list containing ...
decrypt-string-from-alphabet-to-integer-mapping
decrypt-string-from-alphabet-to-integer-mapping__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 formed by digits and '#'. We want to map s to E...
minimum-insertion-steps-to-make-a-string-palindrome
minimum-insertion-steps-to-make-a-string-palindrome__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. In one step you can insert any character at any index ...
minimum-insertion-steps-to-make-a-string-palindrome
minimum-insertion-steps-to-make-a-string-palindrome__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. In one step you can insert any character at any index ...
minimum-insertion-steps-to-make-a-string-palindrome
minimum-insertion-steps-to-make-a-string-palindrome__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. In one step you can insert any character at any index ...
decompress-run-length-encoded-list
decompress-run-length-encoded-list__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\nWe are given a list nums of integers representing a list compressed with...
matrix-block-sum
matrix-block-sum__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 m x n matrix mat and an integer k, return a matrix answer where ...
sum-of-nodes-with-even-valued-grandparent
sum-of-nodes-with-even-valued-grandparent__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, return the sum of values of nodes with ...
minimum-flips-to-make-a-or-b-equal-to-c
minimum-flips-to-make-a-or-b-equal-to-c__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 3 positives numbers a, b and c. Return the minimum flips required ...
number-of-operations-to-make-network-connected
number-of-operations-to-make-network-connected__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 computers numbered from 0 to n - 1 connected by ethernet cab...
minimum-distance-to-type-a-word-using-two-fingers
minimum-distance-to-type-a-word-using-two-fingers__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 have a keyboard layout as shown above in the X-Y plane, where each E...
maximum-69-number
maximum-69-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 positive integer num consisting only of digits 6 and 9.\...
minimum-number-of-taps-to-open-to-water-a-garden
minimum-number-of-taps-to-open-to-water-a-garden__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 one-dimensional garden on the x-axis. The garden starts at th...
break-a-palindrome
break-a-palindrome__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 palindromic string of lowercase English letters palindrome, repl...
sort-the-matrix-diagonally
sort-the-matrix-diagonally__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 matrix diagonal is a diagonal line of cells starting from some cell in...
remove-palindromic-subsequences
remove-palindromic-subsequences__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 consisting only of letters 'a' and 'b'. In a si...
minimum-difficulty-of-a-job-schedule
minimum-difficulty-of-a-job-schedule__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 want to schedule a list of jobs in d days. Jobs are dependent (i.e T...
reduce-array-size-to-the-half
reduce-array-size-to-the-half__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 arr. You can choose a set of integers and...
maximum-product-of-splitted-binary-tree
maximum-product-of-splitted-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, split the binary tree into two subtrees...
jump-game-v
jump-game-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\nGiven an array of integers arr and an integer d. In one step you can jum...
jump-game-v
jump-game-v__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 an array of integers arr and an integer d. In one step you can jum...
number-of-steps-to-reduce-a-number-to-zero
number-of-steps-to-reduce-a-number-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 num, return the number of steps to reduce it to zero.\n...
number-of-steps-to-reduce-a-number-to-zero
number-of-steps-to-reduce-a-number-to-zero__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\nGiven an integer num, return the number of steps to reduce it to zero.\n...
number-of-sub-arrays-of-size-k-and-average-greater-than-or-equal-to-threshold
number-of-sub-arrays-of-size-k-and-average-greater-than-or-equal-to-threshold__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 array of integers arr and two integers k and threshold, return ...
angle-between-hands-of-a-clock
angle-between-hands-of-a-clock__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 numbers, hour and minutes, return the smaller angle (in degree...
jump-game-iv
jump-game-iv__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 an array of integers arr, you are initially positioned at the firs...
check-if-n-and-its-double-exist
check-if-n-and-its-double-exist__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 arr of integers, check if there exist two indices i and j...
minimum-number-of-steps-to-make-two-strings-anagram
minimum-number-of-steps-to-make-two-strings-anagram__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 of the same length s and t. In one step you ca...
maximum-students-taking-exam
maximum-students-taking-exam__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 m * n matrix seats that represent seats distributions in a clas...
count-negative-numbers-in-a-sorted-matrix
count-negative-numbers-in-a-sorted-matrix__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 m x n matrix grid which is sorted in non-increasing order both r...
number-of-substrings-containing-all-three-characters
number-of-substrings-containing-all-three-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\nGiven a string s consisting only of characters a, b and c.\n\nReturn the...
number-of-substrings-containing-all-three-characters
number-of-substrings-containing-all-three-characters__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 string s consisting only of characters a, b and c.\n\nReturn the...
count-all-valid-pickup-and-delivery-options
count-all-valid-pickup-and-delivery-options__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 n orders, each order consists of a pickup and a delivery service.\...
number-of-days-between-two-dates
number-of-days-between-two-dates__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\nWrite a program to count the number of days between two dates.\n\nThe tw...
largest-multiple-of-three
largest-multiple-of-three__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 digits digits, return the largest multiple of three th...
rank-teams-by-votes
rank-teams-by-votes__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\nIn a special ranking system, each voter gives a rank from highest to low...
minimum-cost-to-make-at-least-one-valid-path-in-a-grid
minimum-cost-to-make-at-least-one-valid-path-in-a-grid__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 an m x n grid. Each cell of the grid has a sign pointing to the ne...
longest-zigzag-path-in-a-binary-tree
longest-zigzag-path-in-a-binary-tree__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.\n\nA ZigZag path for a binary t...
maximum-sum-bst-in-binary-tree
maximum-sum-bst-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 a binary tree root, return the maximum sum of all keys of any sub-...
number-of-times-binary-string-is-prefix-aligned
number-of-times-binary-string-is-prefix-aligned__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 a 1-indexed binary string of length n where all the bits are 0 ...
time-needed-to-inform-all-employees
time-needed-to-inform-all-employees__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 company has n employees with a unique ID for each employee from 0 to n...
frog-position-after-t-seconds
frog-position-after-t-seconds__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 an undirected tree consisting of n vertices numbered from 1 to n. ...
lucky-numbers-in-a-matrix
lucky-numbers-in-a-matrix__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 m x n matrix of distinct numbers, return all lucky numbers in t...
cinema-seat-allocation
cinema-seat-allocation__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\nA cinema has n rows of seats, numbered from 1 to n. Each row has 10 seat...
pizza-with-3n-slices
pizza-with-3n-slices__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 pizza with 3n slices of varying size, you and your friends wi...
create-target-array-in-the-given-order
create-target-array-in-the-given-order__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 arrays of integers nums and index. Your task is to create targ...
four-divisors
four-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\nGiven an integer array nums, return the sum of divisors of the integers ...
check-if-there-is-a-valid-path-in-a-grid
check-if-there-is-a-valid-path-in-a-grid__01__python
DFS
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an m x n grid. Each cell of grid represents a street. The ...
longest-happy-prefix
longest-happy-prefix__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 string is called a happy prefix if is a non-empty prefix which is also...
longest-happy-prefix
longest-happy-prefix__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 string is called a happy prefix if is a non-empty prefix which is also...
find-lucky-integer-in-an-array
find-lucky-integer-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\nGiven an array of integers arr, a lucky integer is an integer that has a...
count-number-of-teams
count-number-of-teams__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\nThere are n soldiers standing in a line. Each soldier is assigned a uniq...
count-largest-group
count-largest-group__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 n.\n\nWe need to group the numbers from 1 to n ...
construct-k-palindrome-strings
construct-k-palindrome-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\nGiven a string s and an integer k, return true if you can use all the ch...
circle-and-rectangle-overlapping
circle-and-rectangle-overlapping__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 circle represented as (radius, xCenter, yCenter) and an ...