slug stringlengths 4 77 | solution_id stringlengths 16 89 | primary_algorithm stringclasses 22
values | verified bool 1
class | messages listlengths 3 3 |
|---|---|---|---|---|
minimum-number-game | minimum-number-game__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 of even length and there is... |
minimum-cost-to-convert-string-i | minimum-cost-to-convert-string-i__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 two 0-indexed strings source and target, both of length n ... |
minimum-cost-to-convert-string-ii | minimum-cost-to-convert-string-ii__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 strings source and target, both of length n ... |
most-expensive-item-that-can-not-be-bought | most-expensive-item-that-can-not-be-bought__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 distinct prime numbers primeOne and primeTwo.\n\nAlice... |
find-longest-special-substring-that-occurs-thrice-i | find-longest-special-substring-that-occurs-thrice-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 string s that consists of lowercase English letters.\n\n... |
find-longest-special-substring-that-occurs-thrice-ii | find-longest-special-substring-that-occurs-thrice-ii__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 s that consists of lowercase English letters.\n\n... |
minimum-number-of-operations-to-make-x-and-y-equal | minimum-number-of-operations-to-make-x-and-y-equal__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 positive integers x and y.\n\nIn one operation, you ca... |
count-the-number-of-powerful-integers | count-the-number-of-powerful-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 three integers start, finish, and limit. You are also give... |
maximum-area-of-longest-diagonal-rectangle | maximum-area-of-longest-diagonal-rectangle__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 2D 0-indexed integer array dimensions.\n\nFor all indice... |
minimum-moves-to-capture-the-queen | minimum-moves-to-capture-the-queen__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 a 1-indexed 8 x 8 chessboard containing 3 pieces.\n\nYou are gi... |
maximum-size-of-a-set-after-removals | maximum-size-of-a-set-after-removals__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 of even lengt... |
maximize-the-number-of-partitions-after-operations | maximize-the-number-of-partitions-after-operations__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 and an integer k.\n\nFirst, you are allowed to ... |
maximum-subtree-of-the-same-color | maximum-subtree-of-the-same-color__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 2D integer array edges representing a tree with n nodes,... |
count-elements-with-maximum-frequency | count-elements-with-maximum-frequency__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\nReturn t... |
find-beautiful-indices-in-the-given-array-i | find-beautiful-indices-in-the-given-array-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 string s, a string a, a string b, and an integ... |
maximum-number-that-sum-of-the-prices-is-less-than-or-equal-to-k | maximum-number-that-sum-of-the-prices-is-less-than-or-equal-to-k__01__python | Binary Search | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer k and an integer x. The price of a number num i... |
find-beautiful-indices-in-the-given-array-ii | find-beautiful-indices-in-the-given-array-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 string s, a string a, a string b, and an integ... |
divide-an-array-into-subarrays-with-minimum-cost-i | divide-an-array-into-subarrays-with-minimum-cost-i__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 integers nums of length n.\n\nThe cost of an a... |
find-if-array-can-be-sorted | find-if-array-can-be-sorted__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\nIn one ope... |
minimize-length-of-array-using-operations | minimize-length-of-array-using-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 integer array nums containing positive integer... |
minimum-number-of-pushes-to-type-word-i | minimum-number-of-pushes-to-type-word-i__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 word containing distinct lowercase English letter... |
count-the-number-of-houses-at-a-certain-distance-i | count-the-number-of-houses-at-a-certain-distance-i__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 three positive integers n, x, and y.\n\nIn a city, there e... |
minimum-number-of-pushes-to-type-word-ii | minimum-number-of-pushes-to-type-word-ii__01__python | Greedy | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a string word containing lowercase English letters.\n\nTel... |
count-the-number-of-houses-at-a-certain-distance-ii | count-the-number-of-houses-at-a-certain-distance-ii__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 three positive integers n, x, and y.\n\nIn a city, there e... |
maximum-number-of-removal-queries-that-can-be-processed-i | maximum-number-of-removal-queries-that-can-be-processed-i__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 nums and a 0-indexed array queries.\n\nY... |
find-the-maximum-number-of-elements-in-subset | find-the-maximum-number-of-elements-in-subset__01__python | Hash Table | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an array of positive integers nums.\n\nYou need to select ... |
alice-and-bob-playing-flower-game | alice-and-bob-playing-flower-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 are playing a turn-based game on a field, with two lanes o... |
alice-and-bob-playing-flower-game | alice-and-bob-playing-flower-game__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\nAlice and Bob are playing a turn-based game on a field, with two lanes o... |
minimize-or-of-remaining-elements-using-operations | minimize-or-of-remaining-elements-using-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 integer array nums and an integer k.\n\nIn one... |
type-of-triangle | type-of-triangle__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 size 3 which can form th... |
find-the-number-of-ways-to-place-people-i | find-the-number-of-ways-to-place-people-i__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 2D array points of size n x 2 representing integer coord... |
maximum-good-subarray-sum | maximum-good-subarray-sum__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 of length n and a positive integer k.\n\nA s... |
find-the-number-of-ways-to-place-people-ii | find-the-number-of-ways-to-place-people-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 2D array points of size n x 2 representing integer coord... |
minimum-time-to-revert-word-to-initial-state-i | minimum-time-to-revert-word-to-initial-state-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 a 0-indexed string word and an integer k.\n\nAt every seco... |
minimum-time-to-revert-word-to-initial-state-i | minimum-time-to-revert-word-to-initial-state-i__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 0-indexed string word and an integer k.\n\nAt every seco... |
find-the-grid-of-region-average | find-the-grid-of-region-average__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 m x n grid image which represents a grayscale image, where... |
minimum-time-to-revert-word-to-initial-state-ii | minimum-time-to-revert-word-to-initial-state-ii__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 string word and an integer k.\n\nAt every seco... |
count-numbers-with-unique-digits-ii | count-numbers-with-unique-digits-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 two positive integers a and b, return the count of numbers having ... |
count-numbers-with-unique-digits-ii | count-numbers-with-unique-digits-ii__02__python | Dynamic Programming | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nGiven two positive integers a and b, return the count of numbers having ... |
modify-the-matrix | modify-the-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\nGiven a 0-indexed m x n integer matrix matrix, create a new 0-indexed ma... |
maximum-number-of-operations-with-the-same-score-i | maximum-number-of-operations-with-the-same-score-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 an array of integers nums. Consider the following operatio... |
apply-operations-to-make-string-empty | apply-operations-to-make-string-empty__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 string s.\n\nConsider performing the following operation... |
maximum-number-of-operations-with-the-same-score-ii | maximum-number-of-operations-with-the-same-score-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 array of integers called nums, you can perform any of the follo... |
find-the-length-of-the-longest-common-prefix | find-the-length-of-the-longest-common-prefix__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 arrays with positive integers arr1 and arr2.\n\nA pref... |
split-the-array | split-the-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 of even length. You have to split th... |
minimum-operations-to-exceed-threshold-value-i | minimum-operations-to-exceed-threshold-value-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, and an integer k.\n\nIn on... |
count-pairs-of-connectable-servers-in-a-weighted-tree-network | count-pairs-of-connectable-servers-in-a-weighted-tree-network__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 unrooted weighted tree with n vertices representing ser... |
find-the-maximum-sum-of-node-values | find-the-maximum-sum-of-node-values__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 tree with n nodes numbered 0 to n - 1. You ar... |
distribute-elements-into-two-arrays-i | distribute-elements-into-two-arrays-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 1-indexed array of distinct integers nums of length n.\n... |
count-submatrices-with-top-left-element-and-sum-less-than-k | count-submatrices-with-top-left-element-and-sum-less-than-k__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 matrix grid and an integer k.\n\nRetur... |
minimum-operations-to-write-the-letter-y-on-a-grid | minimum-operations-to-write-the-letter-y-on-a-grid__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 n x n grid where n is odd, and grid[r][c] is 0... |
apple-redistribution-into-boxes | apple-redistribution-into-boxes__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 apple of size n and an array capacity of size m.\... |
maximize-happiness-of-selected-children | maximize-happiness-of-selected-children__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 happiness of length n, and a positive integer k.\... |
shortest-uncommon-substring-in-an-array | shortest-uncommon-substring-in-an-array__01__python | Trie | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an array arr of size n consisting of non-empty strings.\n\... |
make-string-anti-palindrome | make-string-anti-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\nWe call a string s of even length n an anti-palindrome if for each index... |
maximum-length-substring-with-two-occurrences | maximum-length-substring-with-two-occurrences__01__python | Two Pointers | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nGiven a string s, return the maximum length of a substring such that it ... |
apply-operations-to-make-sum-of-array-greater-than-or-equal-to-k | apply-operations-to-make-sum-of-array-greater-than-or-equal-to-k__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 k. Initially, you have an array nums = ... |
longest-common-suffix-queries | longest-common-suffix-queries__01__python | Trie | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given two arrays of strings wordsContainer and wordsQuery.\n\nFo... |
shortest-subarray-with-or-at-least-k-i | shortest-subarray-with-or-at-least-k-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 an array nums of non-negative integers and an integer k.\n... |
minimum-levels-to-gain-more-points | minimum-levels-to-gain-more-points__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 binary array possible of length n.\n\nAlice and Bob are ... |
shortest-subarray-with-or-at-least-k-ii | shortest-subarray-with-or-at-least-k-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 an array nums of non-negative integers and an integer k.\n... |
find-the-sum-of-subsequence-powers | find-the-sum-of-subsequence-powers__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 integer array nums of length n, and a positive integer ... |
harshad-number | harshad-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\nAn integer divisible by the sum of its digits is said to be a Harshad nu... |
water-bottles-ii | water-bottles-ii__01__python | Math | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given two integers numBottles and numExchange.\n\nnumBottles rep... |
find-longest-self-contained-substring | find-longest-self-contained-substring__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 string s, your task is to find the length of the longest self-co... |
longest-strictly-increasing-or-strictly-decreasing-subarray | longest-strictly-increasing-or-strictly-decreasing-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 an array of integers nums. Return the length of the longes... |
minimum-operations-to-make-median-of-array-equal-to-k | minimum-operations-to-make-median-of-array-equal-to-k__01__python | Greedy | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer array nums and a non-negative integer k. In one... |
minimum-cost-walk-in-weighted-graph | minimum-cost-walk-in-weighted-graph__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 an undirected weighted graph with n vertices labeled from 0 to ... |
find-the-index-of-permutation | find-the-index-of-permutation__01__python | Binary Search | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nGiven an array perm of length n which is a permutation of [1, 2, ..., n]... |
find-the-number-of-subarrays-where-boundary-elements-are-maximum | find-the-number-of-subarrays-where-boundary-elements-are-maximum__01__python | Binary Search | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an array of positive integers nums.\n\nReturn the number o... |
latest-time-you-can-obtain-after-replacing-characters | latest-time-you-can-obtain-after-replacing-characters__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 representing a 12-hour format time where some o... |
latest-time-you-can-obtain-after-replacing-characters | latest-time-you-can-obtain-after-replacing-characters__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 string s representing a 12-hour format time where some o... |
minimum-sum-of-values-by-dividing-array | minimum-sum-of-values-by-dividing-array__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 arrays nums and andValues of length n and m respective... |
maximum-number-of-potholes-that-can-be-fixed | maximum-number-of-potholes-that-can-be-fixed__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 road, consisting only of characters \"x\" and \".... |
maximum-number-that-makes-result-of-bitwise-and-zero | maximum-number-that-makes-result-of-bitwise-and-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 n, return the maximum integer x such that x <= n, and t... |
find-all-possible-stable-binary-arrays-i | find-all-possible-stable-binary-arrays-i__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 3 positive integers num_zeros, num_ones, and limit.\n\nA b... |
find-all-possible-stable-binary-arrays-i | find-all-possible-stable-binary-arrays-i__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 3 positive integers num_zeros, num_ones, and limit.\n\nA b... |
find-all-possible-stable-binary-arrays-ii | find-all-possible-stable-binary-arrays-ii__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 3 positive integers num_zeros, num_ones, and limit.\n\nA b... |
find-all-possible-stable-binary-arrays-ii | find-all-possible-stable-binary-arrays-ii__02__python | Dynamic Programming | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given 3 positive integers num_zeros, num_ones, and limit.\n\nA b... |
minimum-array-end | minimum-array-end__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 x. You have to construct an array of po... |
valid-word | valid-word__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 word is considered valid if:\n\n\tIt contains a minimum of 3 character... |
minimum-length-of-anagram-concatenation | minimum-length-of-anagram-concatenation__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 string s, which is known to be a concatenation of anagra... |
maximum-hamming-distances | maximum-hamming-distances__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 nums and an integer m, with each element nums[i] satisfyi... |
check-if-grid-satisfies-conditions | check-if-grid-satisfies-conditions__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 2D matrix grid of size m x n. You need to check if each ... |
maximum-points-inside-the-square | maximum-points-inside-the-square__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 2D array points and a string s where, points[i] represen... |
minimum-substring-partition-of-equal-character-frequency | minimum-substring-partition-of-equal-character-frequency__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 need to partition it into one or more balanced sub... |
minimum-substring-partition-of-equal-character-frequency | minimum-substring-partition-of-equal-character-frequency__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, you need to partition it into one or more balanced sub... |
minimum-substring-partition-of-equal-character-frequency | minimum-substring-partition-of-equal-character-frequency__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, you need to partition it into one or more balanced sub... |
permutation-difference-between-two-strings | permutation-difference-between-two-strings__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 s and t such that every character occurs at mo... |
find-the-minimum-cost-array-permutation | find-the-minimum-cost-array-permutation__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 array nums which is a permutation of [0, 1, 2, ..., n -... |
find-number-of-ways-to-reach-the-k-th-stair | find-number-of-ways-to-reach-the-k-th-stair__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 non-negative integer k. There exists a staircase with an... |
maximum-number-of-upgradable-servers | maximum-number-of-upgradable-servers__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 have n data centers and need to upgrade their servers.\n\nYou are gi... |
find-the-level-of-tree-with-minimum-sum | find-the-level-of-tree-with-minimum-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 root where each node has a value, return... |
find-the-xor-of-numbers-which-appear-twice | find-the-xor-of-numbers-which-appear-twice__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 an array nums, where each number in the array appears eith... |
find-occurrences-of-an-element-in-an-array | find-occurrences-of-an-element-in-an-array__01__python | Math | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer array nums, an integer array queries, and an in... |
find-the-number-of-distinct-colors-among-the-balls | find-the-number-of-distinct-colors-among-the-balls__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 limit and a 2D array queries of size n x 2.\n\n... |
find-the-number-of-good-pairs-i | find-the-number-of-good-pairs-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\nYou are given 2 integer arrays nums1 and nums2 of lengths n and m respec... |
find-the-number-of-good-pairs-i | find-the-number-of-good-pairs-i__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\nYou are given 2 integer arrays nums1 and nums2 of lengths n and m respec... |
find-the-number-of-good-pairs-ii | find-the-number-of-good-pairs-ii__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 2 integer arrays nums1 and nums2 of lengths n and m respec... |
better-compression-of-string | better-compression-of-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 compressed representing a compressed version of a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.