slug stringlengths 4 77 | solution_id stringlengths 16 89 | primary_algorithm stringclasses 22
values | verified bool 1
class | messages listlengths 3 3 |
|---|---|---|---|---|
number-of-beautiful-integers-in-the-range | number-of-beautiful-integers-in-the-range__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 positive integers low, high, and k.\n\nA number is beautif... |
determine-the-minimum-sum-of-a-k-avoiding-array | determine-the-minimum-sum-of-a-k-avoiding-array__01__python | Greedy | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given two integers, n and k.\n\nAn array of distinct positive in... |
find-the-longest-equal-subarray | find-the-longest-equal-subarray__01__python | Two Pointers | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed integer array nums and an integer k.\n\nA suba... |
find-the-longest-equal-subarray | find-the-longest-equal-subarray__02__python | Two Pointers | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed integer array nums and an integer k.\n\nA suba... |
maximal-range-that-each-element-is-maximum-in-it | maximal-range-that-each-element-is-maximum-in-it__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 nums of distinct integers.\n\nLet us def... |
furthest-point-from-origin | furthest-point-from-origin__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 moves of length n consisting only of characters '... |
find-the-minimum-possible-sum-of-a-beautiful-array | find-the-minimum-possible-sum-of-a-beautiful-array__01__python | Greedy | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given positive integers n and target.\n\nAn array nums is beauti... |
minimum-operations-to-form-subsequence-with-target-sum | minimum-operations-to-form-subsequence-with-target-sum__01__python | Greedy | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed array nums consisting of non-negative powers o... |
maximize-value-of-function-in-a-ball-passing-game | maximize-value-of-function-in-a-ball-passing-game__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 receiver of length n and an integer k. n ... |
check-if-strings-can-be-made-equal-with-operations-i | check-if-strings-can-be-made-equal-with-operations-i__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 two strings s1 and s2, both of length 4, consisting of low... |
check-if-strings-can-be-made-equal-with-operations-ii | check-if-strings-can-be-made-equal-with-operations-ii__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 two strings s1 and s2, both of length n, consisting of low... |
maximum-sum-of-almost-unique-subarray | maximum-sum-of-almost-unique-subarray__01__python | Sliding Window | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer array nums and two positive integers m and k.\n... |
count-symmetric-integers | count-symmetric-integers__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 positive integers low and high.\n\nAn integer x consis... |
minimum-operations-to-make-a-special-number | minimum-operations-to-make-a-special-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\nYou are given a 0-indexed string num representing a non-negative integer... |
minimum-edge-weight-equilibrium-queries-in-a-tree | minimum-edge-weight-equilibrium-queries-in-a-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\nThere is an undirected tree with n nodes labeled from 0 to n - 1. You ar... |
smallest-number-with-given-digit-product | smallest-number-with-given-digit-product__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 positive integer n, return a string representing the smallest po... |
points-that-intersect-with-cars | points-that-intersect-with-cars__02__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 representing the coordin... |
determine-if-a-cell-is-reachable-at-a-given-time | determine-if-a-cell-is-reachable-at-a-given-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 four integers sx, sy, fx, fy, and a non-negative integer t... |
minimum-moves-to-spread-stones-over-grid | minimum-moves-to-spread-stones-over-grid__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 2D integer matrix grid of size 3 * 3, represen... |
minimum-right-shifts-to-sort-the-array | minimum-right-shifts-to-sort-the-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\nYou are given a 0-indexed array nums of length n containing distinct pos... |
count-pairs-of-points-with-distance-k | count-pairs-of-points-with-distance-k__01__python | Hash Table | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 2D integer array coordinates and an integer k, where coo... |
sum-of-values-at-indices-with-k-set-bits | sum-of-values-at-indices-with-k-set-bits__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 integer array nums and an integer k.\n\nReturn... |
happy-students | happy-students__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 of length n where n is the ... |
maximum-number-of-alloys | maximum-number-of-alloys__01__python | Binary Search | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are the owner of a company that creates alloys using various types o... |
maximum-element-sum-of-a-complete-subset-of-indices | maximum-element-sum-of-a-complete-subset-of-indices__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 1-indexed array nums. Your task is to select a complete ... |
maximum-length-of-semi-decreasing-subarrays | maximum-length-of-semi-decreasing-subarrays__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.\n\nReturn the length of the longest... |
beautiful-towers-ii | beautiful-towers-ii__01__python | Dynamic Programming | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed array maxHeights of n integers.\n\nYou are tas... |
count-valid-paths-in-a-tree | count-valid-paths-in-a-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\nThere is an undirected tree with n nodes labeled from 1 to n. You are gi... |
count-valid-paths-in-a-tree | count-valid-paths-in-a-tree__02__python | Dynamic Programming | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nThere is an undirected tree with n nodes labeled from 1 to n. You are gi... |
the-wording-game | the-wording-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 each have a lexicographically sorted array of strings name... |
minimum-operations-to-collect-elements | minimum-operations-to-collect-elements__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 nums of positive integers and an integer k.\n\nIn... |
minimum-number-of-operations-to-make-array-empty | minimum-number-of-operations-to-make-array-empty__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\... |
split-array-into-maximum-number-of-subarrays | split-array-into-maximum-number-of-subarrays__01__python | Greedy | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an array nums consisting of non-negative integers.\n\nWe d... |
maximum-number-of-k-divisible-components | maximum-number-of-k-divisible-components__01__python | DFS | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nThere is an undirected tree with n nodes labeled from 0 to n - 1. You ar... |
maximum-value-of-an-ordered-triplet-i | maximum-value-of-an-ordered-triplet-i__01__python | Array | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed integer array nums.\n\nReturn the maximum valu... |
maximum-value-of-an-ordered-triplet-ii | maximum-value-of-an-ordered-triplet-ii__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.\n\nReturn the maximum valu... |
minimum-size-subarray-in-infinite-array | minimum-size-subarray-in-infinite-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 and an integer target.\n\nA 0-index... |
count-visited-nodes-in-a-directed-graph | count-visited-nodes-in-a-directed-graph__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 directed graph consisting of n nodes numbered from 0 to n - 1... |
minimizing-array-after-replacing-pairs-with-their-product | minimizing-array-after-replacing-pairs-with-their-product__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, you can perform the follow... |
divisible-and-non-divisible-sums-difference | divisible-and-non-divisible-sums-difference__01__python | Math | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given positive integers n and m.\n\nDefine two integers as follo... |
minimum-processing-time | minimum-processing-time__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 have a certain number of processors, each having 4 cores. The number... |
apply-operations-to-make-two-strings-equal | apply-operations-to-make-two-strings-equal__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 two 0-indexed binary strings s1 and s2, both of length n, ... |
apply-operations-on-array-to-maximize-sum-of-squares | apply-operations-on-array-to-maximize-sum-of-squares__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 a positive integer k.\n... |
maximum-linear-stock-score | maximum-linear-stock-score__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 1-indexed integer array prices, where prices[i] is the price of ... |
last-visited-integers | last-visited-integers__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 where nums[i] is either a positive integer o... |
find-indices-with-index-and-value-difference-i | find-indices-with-index-and-value-difference-i__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 0-indexed integer array nums having length n, an integer... |
shortest-and-lexicographically-smallest-beautiful-string | shortest-and-lexicographically-smallest-beautiful-string__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 string s and a positive integer k.\n\nA substring... |
shortest-and-lexicographically-smallest-beautiful-string | shortest-and-lexicographically-smallest-beautiful-string__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 binary string s and a positive integer k.\n\nA substring... |
find-indices-with-index-and-value-difference-ii | find-indices-with-index-and-value-difference-ii__01__python | Two Pointers | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed integer array nums having length n, an integer... |
construct-product-matrix | construct-product-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 a 0-indexed 2D integer matrix grid of size n * m, we define a 0-in... |
maximum-profitable-triplets-with-increasing-prices-i | maximum-profitable-triplets-with-increasing-prices-i__01__python | Brute Force | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nGiven the 0-indexed arrays prices and profits of length n. There are n i... |
maximum-profitable-triplets-with-increasing-prices-i | maximum-profitable-triplets-with-increasing-prices-i__02__python | Array | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nGiven the 0-indexed arrays prices and profits of length n. There are n i... |
minimum-sum-of-mountain-triplets-i | minimum-sum-of-mountain-triplets-i__01__python | Array | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed array nums of integers.\n\nA triplet of indice... |
minimum-sum-of-mountain-triplets-ii | minimum-sum-of-mountain-triplets-ii__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 nums of integers.\n\nA triplet of indice... |
number-of-ways-to-reach-destination-in-the-grid | number-of-ways-to-reach-destination-in-the-grid__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 integers n and m which represent the size of a 1-index... |
subarrays-distinct-element-sum-of-squares-i | subarrays-distinct-element-sum-of-squares-i__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.\n\nThe distinct count of a... |
minimum-number-of-changes-to-make-binary-string-beautiful | minimum-number-of-changes-to-make-binary-string-beautiful__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 0-indexed binary string s having an even length.\n\nA st... |
length-of-the-longest-subsequence-that-sums-to-target | length-of-the-longest-subsequence-that-sums-to-target__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 array of integers nums, and an integer target.... |
length-of-the-longest-subsequence-that-sums-to-target | length-of-the-longest-subsequence-that-sums-to-target__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 array of integers nums, and an integer target.... |
minimum-equal-sum-of-two-arrays-after-replacing-zeros | minimum-equal-sum-of-two-arrays-after-replacing-zeros__01__python | Greedy | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given two arrays nums1 and nums2 consisting of positive integers... |
minimum-increment-operations-to-make-array-beautiful | minimum-increment-operations-to-make-array-beautiful__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 having length n, and an int... |
maximum-points-after-collecting-coins-from-all-nodes | maximum-points-after-collecting-coins-from-all-nodes__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\nThere exists an undirected tree rooted at node 0 with n nodes labeled fr... |
maximum-profitable-triplets-with-increasing-prices-ii | maximum-profitable-triplets-with-increasing-prices-ii__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 the 0-indexed arrays prices and profits of length n. There are n i... |
find-champion-i | find-champion-i__01__python | Array | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nThere are n teams numbered from 0 to n - 1 in a tournament.\n\nGiven a 0... |
maximum-score-after-applying-operations-on-a-tree | maximum-score-after-applying-operations-on-a-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\nThere is an undirected tree with n nodes labeled from 0 to n - 1, and ro... |
number-of-strings-which-can-be-rearranged-to-contain-substring | number-of-strings-which-can-be-rearranged-to-contain-substring__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 n.\n\nA string s is called good if it contains ... |
number-of-strings-which-can-be-rearranged-to-contain-substring | number-of-strings-which-can-be-rearranged-to-contain-substring__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 an integer n.\n\nA string s is called good if it contains ... |
maximum-strong-pair-xor-i | maximum-strong-pair-xor-i__01__python | Sliding Window | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed integer array nums. A pair of integers x and y... |
maximum-strong-pair-xor-i | maximum-strong-pair-xor-i__02__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. A pair of integers x and y... |
minimum-operations-to-maximize-last-elements-in-arrays | minimum-operations-to-maximize-last-elements-in-arrays__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 0-indexed integer arrays, nums1 and nums2, both having... |
maximum-strong-pair-xor-ii | maximum-strong-pair-xor-ii__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. A pair of integers x and y... |
separate-black-and-white-balls | separate-black-and-white-balls__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 balls on a table, each ball has a color black or white.\n\nY... |
maximum-xor-product | maximum-xor-product__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 three integers a, b, and n, return the maximum value of (a XOR x) ... |
find-words-containing-character | find-words-containing-character__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 words and a character x.\n\nR... |
minimum-number-of-coins-for-fruits | minimum-number-of-coins-for-fruits__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 0-indexed integer array prices where prices[i] denotes ... |
minimum-number-of-coins-for-fruits | minimum-number-of-coins-for-fruits__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 an 0-indexed integer array prices where prices[i] denotes ... |
minimum-number-of-coins-for-fruits | minimum-number-of-coins-for-fruits__03__python | Dynamic Programming | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an 0-indexed integer array prices where prices[i] denotes ... |
matrix-similarity-after-cyclic-shifts | matrix-similarity-after-cyclic-shifts__01__python | Math | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an m x n integer matrix mat and an integer k. The matrix r... |
count-beautiful-substrings-i | count-beautiful-substrings-i__01__python | Math | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a string s and a positive integer k.\n\nLet vowels and con... |
make-lexicographically-smallest-array-by-swapping-elements | make-lexicographically-smallest-array-by-swapping-elements__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 array of positive integers nums and a positive... |
number-of-divisible-substrings | number-of-divisible-substrings__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\nEach character of the English alphabet has been mapped to a digit as sho... |
number-of-divisible-substrings | number-of-divisible-substrings__02__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\nEach character of the English alphabet has been mapped to a digit as sho... |
find-the-peaks | find-the-peaks__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 mountain. Your task is to find all the p... |
minimum-number-of-coins-to-be-added | minimum-number-of-coins-to-be-added__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 coins, representing the values o... |
count-complete-substrings | count-complete-substrings__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 integer k.\n\nA substring s of word i... |
number-of-same-end-substrings | number-of-same-end-substrings__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 string s, and a 2D array of integers queries, ... |
find-common-elements-between-two-arrays | find-common-elements-between-two-arrays__01__python | Hash Table | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given two integer arrays nums1 and nums2 of sizes n and m, respe... |
remove-adjacent-almost-equal-characters | remove-adjacent-almost-equal-characters__01__python | Greedy | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed string word.\n\nIn one operation, you can pick... |
length-of-longest-subarray-with-at-most-k-frequency | length-of-longest-subarray-with-at-most-k-frequency__01__python | Two Pointers | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer array nums and an integer k.\n\nThe frequency o... |
number-of-possible-sets-of-closing-branches | number-of-possible-sets-of-closing-branches__01__python | Graph | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nThere is a company with n branches across the country, some of which are... |
double-modular-exponentiation | double-modular-exponentiation__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 2D array variables where variables[i] = [ai, b... |
count-subarrays-where-max-element-appears-at-least-k-times | count-subarrays-where-max-element-appears-at-least-k-times__01__python | Two Pointers | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer array nums and a positive integer k.\n\nReturn ... |
count-the-number-of-good-partitions | count-the-number-of-good-partitions__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 consisting of positive integers.\n\... |
number-of-divisible-triplet-sums | number-of-divisible-triplet-sums__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 0-indexed integer array nums and an integer d, return the number... |
find-missing-and-repeated-values | find-missing-and-repeated-values__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 2D integer matrix grid of size n * n with valu... |
divide-array-into-arrays-with-max-difference | divide-array-into-arrays-with-max-difference__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 of size n where n is a multiple of 3... |
minimum-number-of-coins-for-fruits-ii | minimum-number-of-coins-for-fruits-ii__01__python | Dynamic Programming | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are at a fruit market with different types of exotic fruits on displ... |
count-the-number-of-incremovable-subarrays-i | count-the-number-of-incremovable-subarrays-i__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 0-indexed array of positive integers nums.\n\nA subarray... |
count-the-number-of-incremovable-subarrays-ii | count-the-number-of-incremovable-subarrays-ii__01__python | Two Pointers | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed array of positive integers nums.\n\nA subarray... |
find-number-of-coins-to-place-in-tree-nodes | find-number-of-coins-to-place-in-tree-nodes__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 undirected tree with n nodes labeled from 0 to n - 1, a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.