slug stringlengths 4 77 | solution_id stringlengths 16 89 | primary_algorithm stringclasses 22
values | verified bool 1
class | messages listlengths 3 3 |
|---|---|---|---|---|
form-smallest-number-from-two-digit-arrays | form-smallest-number-from-two-digit-arrays__03__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 two arrays of unique digits nums1 and nums2, return the smallest n... |
find-the-substring-with-maximum-cost | find-the-substring-with-maximum-cost__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, a string chars of distinct characters and an i... |
find-the-substring-with-maximum-cost | find-the-substring-with-maximum-cost__02__python | Dynamic Programming | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a string s, a string chars of distinct characters and an i... |
shortest-cycle-in-a-graph | shortest-cycle-in-a-graph__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\nThere is a bi-directional graph with n vertices, where each vertex is la... |
shortest-cycle-in-a-graph | shortest-cycle-in-a-graph__02__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\nThere is a bi-directional graph with n vertices, where each vertex is la... |
find-the-longest-balanced-substring-of-a-binary-string | find-the-longest-balanced-substring-of-a-binary-string__01__python | Brute Force | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a binary string s consisting only of zeroes and ones.\n\nA... |
find-the-longest-balanced-substring-of-a-binary-string | find-the-longest-balanced-substring-of-a-binary-string__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\nYou are given a binary string s consisting only of zeroes and ones.\n\nA... |
mice-and-cheese | mice-and-cheese__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 are two mice and n different types of cheese, each type of cheese ... |
mice-and-cheese | mice-and-cheese__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\nThere are two mice and n different types of cheese, each type of cheese ... |
beautiful-pairs | beautiful-pairs__01__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\nYou are given two 0-indexed integer arrays nums1 and nums2 of the same l... |
sum-of-distances | sum-of-distances__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 0-indexed integer array nums. There exists an array arr ... |
count-the-number-of-k-free-subsets | count-the-number-of-k-free-subsets__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, which contains distinct elements an... |
find-the-width-of-columns-of-a-grid | find-the-width-of-columns-of-a-grid__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 0-indexed m x n integer matrix grid. The width of a colu... |
find-the-score-of-all-prefixes-of-an-array | find-the-score-of-all-prefixes-of-an-array__01__python | Array | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nWe define the conversion array conver of an array arr as follows:\n\n\tc... |
row-with-maximum-ones | row-with-maximum-ones__01__python | Math | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nGiven a m x n binary matrix mat, find the 0-indexed position of the row ... |
find-the-maximum-divisibility-score | find-the-maximum-divisibility-score__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 integer arrays nums and divisors.\n\nThe divisibility ... |
minimum-additions-to-make-valid-string | minimum-additions-to-make-valid-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\nGiven a string word to which you can insert letters \"a\", \"b\" or \"c\... |
minimize-the-total-price-of-the-trips | minimize-the-total-price-of-the-trips__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 exists an undirected and unrooted tree with n nodes indexed from 0... |
calculate-delayed-arrival-time | calculate-delayed-arrival-time__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 arrivalTime denoting the arrival time o... |
sum-multiples | sum-multiples__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 n, find the sum of all integers in the range [1... |
sum-multiples | sum-multiples__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\nGiven a positive integer n, find the sum of all integers in the range [1... |
sliding-subarray-beauty | sliding-subarray-beauty__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 containing n integers, find the beauty of ea... |
maximum-sum-with-exactly-k-elements | maximum-sum-with-exactly-k-elements__01__python | Greedy | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed integer array nums and an integer k. Your task... |
find-the-prefix-common-array-of-two-arrays | find-the-prefix-common-array-of-two-arrays__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 two 0-indexed integer permutations A and B of length n.\n\... |
find-the-prefix-common-array-of-two-arrays | find-the-prefix-common-array-of-two-arrays__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\nYou are given two 0-indexed integer permutations A and B of length n.\n\... |
find-the-prefix-common-array-of-two-arrays | find-the-prefix-common-array-of-two-arrays__03__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 two 0-indexed integer permutations A and B of length n.\n\... |
determine-the-winner-of-a-bowling-game | determine-the-winner-of-a-bowling-game__01__python | Math | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given two 0-indexed integer arrays player1 and player2, represen... |
first-completely-painted-row-or-column | first-completely-painted-row-or-column__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 0-indexed integer array arr, and an m x n integer matrix... |
lexicographically-smallest-beautiful-string | lexicographically-smallest-beautiful-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\nA string is beautiful if:\n\n\tIt consists of the first k letters of the... |
find-the-distinct-difference-array | find-the-distinct-difference-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 a 0-indexed array nums of length n.\n\nThe distinct differ... |
number-of-adjacent-elements-with-the-same-color | number-of-adjacent-elements-with-the-same-color__01__python | Array | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer n representing an array colors of length n wher... |
make-costs-of-paths-equal-in-a-binary-tree | make-costs-of-paths-equal-in-a-binary-tree__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 n representing the number of nodes in a perfect... |
number-of-senior-citizens | number-of-senior-citizens__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 0-indexed array of strings details. Each element of deta... |
sum-in-a-matrix | sum-in-a-matrix__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 0-indexed 2D integer array nums. Initially, your score i... |
maximum-or | maximum-or__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 0-indexed integer array nums of length n and an integer ... |
power-of-heroes | power-of-heroes__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 0-indexed integer array nums representing the strength o... |
find-the-losers-of-the-circular-game | find-the-losers-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 ... |
maximum-number-of-moves-in-a-grid | maximum-number-of-moves-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\nYou are given a 0-indexed m x n matrix grid consisting of positive integ... |
minimum-string-length-after-removing-substrings | minimum-string-length-after-removing-substrings__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 uppercase English letters.\n... |
lexicographically-smallest-palindrome | lexicographically-smallest-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\nYou are given a string s consisting of lowercase English letters, and yo... |
find-the-punishment-number-of-an-integer | find-the-punishment-number-of-an-integer__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 positive integer n, return the punishment number of n.\n\nThe pu... |
buy-two-chocolates | buy-two-chocolates__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 prices representing the prices of various... |
buy-two-chocolates | buy-two-chocolates__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 prices representing the prices of various... |
extra-characters-in-a-string | extra-characters-in-a-string__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 string s and a dictionary of words dictionary.... |
extra-characters-in-a-string | extra-characters-in-a-string__02__python | Dynamic Programming | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed string s and a dictionary of words dictionary.... |
maximum-strength-of-a-group | maximum-strength-of-a-group__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 integer array nums representing the score of s... |
maximum-strength-of-a-group | maximum-strength-of-a-group__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 a 0-indexed integer array nums representing the score of s... |
greatest-common-divisor-traversal | greatest-common-divisor-traversal__01__python | Graph | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed integer array nums, and you are allowed to tra... |
remove-trailing-zeros-from-a-string | remove-trailing-zeros-from-a-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\nGiven a positive integer num represented as a string, return the integer... |
minimum-cost-to-make-all-characters-equal | minimum-cost-to-make-all-characters-equal__01__python | Greedy | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed binary string s of length n on which you can a... |
minimize-string-length | minimize-string-length__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, you have two types of operation:\n\n\tChoose an index ... |
semi-ordered-permutation | semi-ordered-permutation__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 0-indexed permutation of n integers nums.\n\nA permutati... |
sum-of-matrix-after-queries | sum-of-matrix-after-queries__01__python | Hash Table | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer n and a 0-indexed 2D array queries where querie... |
count-of-integers | count-of-integers__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 numeric strings num1 and num2 and two integers max_sum... |
check-if-the-number-is-fascinating | check-if-the-number-is-fascinating__01__python | Math | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer n that consists of exactly 3 digits.\n\nWe call... |
find-the-longest-semi-repetitive-substring | find-the-longest-semi-repetitive-substring__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 digit string s that consists of digits from 0 to 9.\n\nA... |
find-the-longest-semi-repetitive-substring | find-the-longest-semi-repetitive-substring__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 a digit string s that consists of digits from 0 to 9.\n\nA... |
movement-of-robots | movement-of-robots__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\nSome robots are standing on an infinite number line with their initial c... |
find-a-good-subset-of-the-matrix | find-a-good-subset-of-the-matrix__01__python | Bit Manipulation | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed m x n binary matrix grid.\n\nLet us call a non... |
lexicographically-smallest-string-after-substring-operation | lexicographically-smallest-string-after-substring-operation__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 consisting of lowercase English letters. Perform the fo... |
collecting-chocolates | collecting-chocolates__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 0-indexed integer array nums of size n representing the ... |
find-the-closest-marked-node | find-the-closest-marked-node__01__python | Graph | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a positive integer n which is the number of nodes of a 0-i... |
total-distance-traveled | total-distance-traveled__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 truck has two fuel tanks. You are given two integers, mainTank represe... |
special-permutations | special-permutations__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 integer array nums containing n distinct posit... |
painting-the-walls | painting-the-walls__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 0-indexed integer arrays, cost and time, of size n rep... |
count-substrings-without-repeating-character | count-substrings-without-repeating-character__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 lowercase English letters. W... |
find-maximum-number-of-string-pairs | find-maximum-number-of-string-pairs__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 0-indexed array words consisting of distinct strings.\n\... |
ways-to-split-array-into-good-subarrays | ways-to-split-array-into-good-subarrays__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 binary array nums.\n\nA subarray of an array is good if ... |
longest-even-odd-subarray-with-threshold | longest-even-odd-subarray-with-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\nYou are given a 0-indexed integer array nums and an integer threshold.\n... |
longest-even-odd-subarray-with-threshold | longest-even-odd-subarray-with-threshold__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 0-indexed integer array nums and an integer threshold.\n... |
prime-pairs-with-target-sum | prime-pairs-with-target-sum__01__python | Math | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer n. We say that two integers x and y form a prim... |
is-array-a-preorder-of-some-binary-tree | is-array-a-preorder-of-some-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 0-indexed integer 2D array nodes, your task is to determine if t... |
longest-alternating-subarray | longest-alternating-subarray__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 0-indexed integer array nums. A subarray s of length m i... |
relocate-marbles | relocate-marbles__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 0-indexed integer array nums representing the initial po... |
partition-string-into-minimum-beautiful-substrings | partition-string-into-minimum-beautiful-substrings__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 binary string s, partition the string into one or more substring... |
find-the-maximum-achievable-number | find-the-maximum-achievable-number__01__python | Math | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nGiven two integers, num and t. A number x is achievable if it can become... |
maximum-number-of-jumps-to-reach-the-last-index | maximum-number-of-jumps-to-reach-the-last-index__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 a 0-indexed array nums of n integers and an integer target... |
apply-operations-to-make-all-array-elements-equal-to-zero | apply-operations-to-make-all-array-elements-equal-to-zero__01__python | Array | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed integer array nums and a positive integer k.\n... |
sum-of-squares-of-special-elements | sum-of-squares-of-special-elements__01__python | Array | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 1-indexed integer array nums of length n.\n\nAn element ... |
minimum-index-of-a-valid-split | minimum-index-of-a-valid-split__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\nAn element x of an integer array arr of length m is dominant if more tha... |
length-of-the-longest-valid-substring | length-of-the-longest-valid-substring__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 string word and an array of strings forbidden.\n\nA stri... |
check-if-array-is-good | check-if-array-is-good__01__python | Sorting | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer array nums. We consider an array good if it is ... |
sort-vowels-in-a-string | sort-vowels-in-a-string__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 0-indexed string s, permute s to get a new string t such that:\n... |
visit-array-positions-to-maximize-score | visit-array-positions-to-maximize-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 0-indexed integer array nums and a positive integer x.\n... |
ways-to-express-an-integer-as-sum-of-powers | ways-to-express-an-integer-as-sum-of-powers__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 two positive integers n and x.\n\nReturn the number of ways n can ... |
largest-element-in-an-array-after-merge-operations | largest-element-in-an-array-after-merge-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 a 0-indexed array nums consisting of positive integers.\n\... |
maximum-number-of-groups-with-increasing-length | maximum-number-of-groups-with-increasing-length__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 0-indexed array usageLimits of length n.\n\nYour task is... |
maximum-number-of-groups-with-increasing-length | maximum-number-of-groups-with-increasing-length__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 a 0-indexed array usageLimits of length n.\n\nYour task is... |
count-paths-that-can-form-a-palindrome-in-a-tree | count-paths-that-can-form-a-palindrome-in-a-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\nYou are given a tree (i.e. a connected, undirected graph that has no cyc... |
number-of-employees-who-met-the-target | number-of-employees-who-met-the-target__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 employees in a company, numbered from 0 to n - 1. Each emplo... |
count-complete-subarrays-in-an-array | count-complete-subarrays-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 consisting of positive integers.\n\nWe call ... |
count-complete-subarrays-in-an-array | count-complete-subarrays-in-an-array__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 nums consisting of positive integers.\n\nWe call ... |
find-the-k-th-lucky-number | find-the-k-th-lucky-number__01__python | Math | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nWe know that 4 and 7 are lucky digits. Also, a number is called lucky if... |
account-balance-after-rounded-purchase | account-balance-after-rounded-purchase__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\nInitially, you have a bank account balance of 100 dollars.\n\nYou are gi... |
minimum-time-to-make-array-sum-at-most-x | minimum-time-to-make-array-sum-at-most-x__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 0-indexed integer arrays nums1 and nums2 of equal leng... |
faulty-keyboard | faulty-keyboard__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\nYour laptop keyboard is faulty, and whenever you type a character 'i' on... |
max-pair-sum-in-an-array | max-pair-sum-in-an-array__01__python | Hash Table | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer array nums. You have to find the maximum sum of... |
double-a-number-represented-as-a-linked-list | double-a-number-represented-as-a-linked-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\nYou are given the head of a non-empty linked list representing a non-neg... |
make-string-a-subsequence-using-cyclic-increments | make-string-a-subsequence-using-cyclic-increments__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 0-indexed strings str1 and str2.\n\nIn an operation, y... |
sorting-three-groups | sorting-three-groups__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. Each element in nums is 1, 2 or 3. ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.