slug stringlengths 4 77 | solution_id stringlengths 16 89 | primary_algorithm stringclasses 22
values | verified bool 1
class | messages listlengths 3 3 |
|---|---|---|---|---|
moving-stones-until-consecutive-ii | moving-stones-until-consecutive-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\nThere are some stones in different positions on the X-axis. You are give... |
robot-bounded-in-circle | robot-bounded-in-circle__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\nOn an infinite plane, a robot initially stands at (0, 0) and faces north... |
flower-planting-with-no-adjacent | flower-planting-with-no-adjacent__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 have n gardens, labeled from 1 to n, and an array paths where paths[... |
partition-array-for-maximum-sum | partition-array-for-maximum-sum__01__python | Dynamic Programming | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nGiven an integer array arr, partition the array into (contiguous) subarr... |
longest-duplicate-substring | longest-duplicate-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\nGiven a string s, consider all duplicated substrings: (contiguous) subst... |
remove-all-adjacent-duplicates-in-string | remove-all-adjacent-duplicates-in-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\nYou are given a string s consisting of lowercase English letters. A dupl... |
last-stone-weight-ii | last-stone-weight-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 an array of integers stones where stones[i] is the weight ... |
last-stone-weight-ii | last-stone-weight-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 an array of integers stones where stones[i] is the weight ... |
height-checker | height-checker__01__python | Sorting | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nA school is trying to take an annual photo of all the students. The stud... |
height-checker | height-checker__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\nA school is trying to take an annual photo of all the students. The stud... |
grumpy-bookstore-owner | grumpy-bookstore-owner__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\nThere is a bookstore owner that has a store open for n minutes. You are ... |
previous-permutation-with-one-swap | previous-permutation-with-one-swap__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 array of positive integers arr (not necessarily distinct), retu... |
shortest-way-to-form-string | shortest-way-to-form-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\nA subsequence of a string is a new string that is formed from the origin... |
confusing-number | confusing-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\nA confusing number is a number that when rotated 180 degrees becomes a d... |
minimize-rounding-error-to-meet-target | minimize-rounding-error-to-meet-target__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 array of prices [p1,p2...,pn] and a target, round each price pi... |
all-paths-from-source-lead-to-destination | all-paths-from-source-lead-to-destination__01__python | DFS | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nGiven the edges of a directed graph where edges[i] = [ai, bi] indicates ... |
missing-element-in-sorted-array | missing-element-in-sorted-array__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 integer array nums which is sorted in ascending order and all o... |
number-of-valid-subarrays | number-of-valid-subarrays__01__python | Array | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nGiven an integer array nums, return the number of non-empty subarrays wi... |
number-of-valid-subarrays | number-of-valid-subarrays__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 an integer array nums, return the number of non-empty subarrays wi... |
fixed-point | fixed-point__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 of distinct integers arr, where arr is sorted in ascendin... |
index-pairs-of-a-string | index-pairs-of-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 string text and an array of strings words, return an array of al... |
index-pairs-of-a-string | index-pairs-of-a-string__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\nGiven a string text and an array of strings words, return an array of al... |
digit-count-in-range | digit-count-in-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\nGiven a single-digit integer d and two integers low and high, return the... |
greatest-common-divisor-of-strings | greatest-common-divisor-of-strings__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\nFor two strings s and t, we say \"t divides s\" if and only if s = t + t... |
flip-columns-for-maximum-number-of-equal-rows | flip-columns-for-maximum-number-of-equal-rows__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 m x n binary matrix matrix.\n\nYou can choose any numbe... |
number-of-submatrices-that-sum-to-target | number-of-submatrices-that-sum-to-target__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 matrix and a target, return the number of non-empty submatrices ... |
occurrences-after-bigram | occurrences-after-bigram__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 two strings first and second, consider occurrences in some text of... |
smallest-subsequence-of-distinct-characters | smallest-subsequence-of-distinct-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\nGiven a string s, return the lexicographically smallest subsequence of s... |
sum-of-digits-in-the-minimum-number | sum-of-digits-in-the-minimum-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 an integer array nums, return 0 if the sum of the digits of the mi... |
brace-expansion | brace-expansion__01__python | Backtracking | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a string s representing a list of words. Each letter in th... |
confusing-number-ii | confusing-number-ii__01__python | Backtracking | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nA confusing number is a number that when rotated 180 degrees becomes a d... |
duplicate-zeros | duplicate-zeros__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 fixed-length integer array arr, duplicate each occurrence of zer... |
largest-values-from-labels | largest-values-from-labels__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 n item's value and label as two integer arrays values and ... |
shortest-path-in-binary-matrix | shortest-path-in-binary-matrix__01__python | BFS | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nGiven an n x n binary matrix grid, return the length of the shortest cle... |
shortest-common-supersequence | shortest-common-supersequence__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 strings str1 and str2, return the shortest string that has bot... |
brace-expansion-ii | brace-expansion-ii__01__python | Backtracking | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nUnder the grammar given below, strings can represent a set of lowercase ... |
find-k-length-substrings-with-no-repeated-characters | find-k-length-substrings-with-no-repeated-characters__01__python | Sliding Window | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nGiven a string s and an integer k, return the number of substrings in s ... |
the-earliest-moment-when-everyone-become-friends | the-earliest-moment-when-everyone-become-friends__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\nThere are n people in a social group labeled from 0 to n - 1. You are gi... |
the-earliest-moment-when-everyone-become-friends | the-earliest-moment-when-everyone-become-friends__02__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 are n people in a social group labeled from 0 to n - 1. You are gi... |
path-in-zigzag-labelled-binary-tree | path-in-zigzag-labelled-binary-tree__01__python | Math | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nIn an infinite binary tree where every node has two children, the nodes ... |
filling-bookcase-shelves | filling-bookcase-shelves__01__python | Dynamic Programming | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an array books where books[i] = [thicknessi, heighti] indi... |
parsing-a-boolean-expression | parsing-a-boolean-expression__01__python | Recursion | true | [
{
"role": "system",
"content": "You 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 boolean expression is an expression that evaluates to either true or f... |
defanging-an-ip-address | defanging-an-ip-address__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 valid (IPv4) IP address, return a defanged version of that IP ad... |
corporate-flight-bookings | corporate-flight-bookings__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\nThere are n flights that are labeled from 1 to n.\n\nYou are given an ar... |
number-of-days-in-a-month | number-of-days-in-a-month__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 year year and a month month, return the number of days of that m... |
remove-vowels-from-a-string | remove-vowels-from-a-string__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 string s, remove the vowels 'a', 'e', 'i', 'o', and 'u' from it,... |
maximum-average-subtree | maximum-average-subtree__01__python | Recursion | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nGiven the root of a binary tree, return the maximum average value of a s... |
relative-sort-array | relative-sort-array__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 two arrays arr1 and arr2, the elements of arr2 are distinct, and a... |
relative-sort-array | relative-sort-array__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\nGiven two arrays arr1 and arr2, the elements of arr2 are distinct, and a... |
lowest-common-ancestor-of-deepest-leaves | lowest-common-ancestor-of-deepest-leaves__01__python | DFS | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nGiven the root of a binary tree, return the lowest common ancestor of it... |
number-of-equivalent-domino-pairs | number-of-equivalent-domino-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\nGiven a list of dominoes, dominoes[i] = [a, b] is equivalent to dominoes... |
shortest-path-with-alternating-colors | shortest-path-with-alternating-colors__01__python | BFS | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer n, the number of nodes in a directed graph wher... |
minimum-cost-tree-from-leaf-values | minimum-cost-tree-from-leaf-values__02__python | Dynamic Programming | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nGiven an array arr of positive integers, consider all binary trees such ... |
minimum-cost-tree-from-leaf-values | minimum-cost-tree-from-leaf-values__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 an array arr of positive integers, consider all binary trees such ... |
largest-unique-number | largest-unique-number__01__python | Sorting | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nGiven an integer array nums, return the largest integer that only occurs... |
armstrong-number | armstrong-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 an integer n, return true if and only if it is an Armstrong number... |
connecting-cities-with-minimum-cost | connecting-cities-with-minimum-cost__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 are n cities labeled from 1 to n. You are given the integer n and ... |
parallel-courses | parallel-courses__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 n, which indicates that there are n courses lab... |
n-th-tribonacci-number | n-th-tribonacci-number__01__python | Dynamic Programming | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nThe Tribonacci sequence Tn is defined as follows: \n\nT0 = 0, T1 = 1, T2... |
n-th-tribonacci-number | n-th-tribonacci-number__02__python | Dynamic Programming | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nThe Tribonacci sequence Tn is defined as follows: \n\nT0 = 0, T1 = 1, T2... |
largest-1-bordered-square | largest-1-bordered-square__01__python | Dynamic Programming | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nGiven a 2D grid of 0s and 1s, return the number of elements in the large... |
longest-common-subsequence | longest-common-subsequence__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 strings text1 and text2, return the length of their longest co... |
decrease-elements-to-make-array-zigzag | decrease-elements-to-make-array-zigzag__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 array nums of integers, a move consists of choosing any element... |
longest-chunked-palindrome-decomposition | longest-chunked-palindrome-decomposition__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 text. You should split it to k substrings (subtex... |
longest-chunked-palindrome-decomposition | longest-chunked-palindrome-decomposition__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 text. You should split it to k substrings (subtex... |
minimum-swaps-to-group-all-1s-together | minimum-swaps-to-group-all-1s-together__01__python | Sliding Window | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nGiven a binary array data, return the minimum number of swaps required t... |
day-of-the-year | day-of-the-year__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 string date representing a Gregorian calendar date formatted as ... |
number-of-dice-rolls-with-target-sum | number-of-dice-rolls-with-target-sum__01__python | Dynamic Programming | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou have n dice, and each dice has k faces numbered from 1 to k.\n\nGive... |
number-of-dice-rolls-with-target-sum | number-of-dice-rolls-with-target-sum__02__python | Dynamic Programming | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou have n dice, and each dice has k faces numbered from 1 to k.\n\nGive... |
swap-for-longest-repeated-character-substring | swap-for-longest-repeated-character-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 string text. You can swap two of the characters in the t... |
find-words-that-can-be-formed-by-characters | find-words-that-can-be-formed-by-characters__01__python | Hash Table | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an array of strings words and a string chars.\n\nA string ... |
last-substring-in-lexicographical-order | last-substring-in-lexicographical-order__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 last substring of s in lexicographical orde... |
optimize-water-distribution-in-a-village | optimize-water-distribution-in-a-village__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 are n houses in a village. We want to supply water for all the hou... |
optimize-water-distribution-in-a-village | optimize-water-distribution-in-a-village__02__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 are n houses in a village. We want to supply water for all the hou... |
invalid-transactions | invalid-transactions__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 transaction is possibly invalid if:\n\n\tthe amount exceeds $1000, or;... |
number-of-valid-words-for-each-puzzle | number-of-valid-words-for-each-puzzle__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\nWith respect to a given puzzle string, a word is valid if both the follo... |
before-and-after-puzzle | before-and-after-puzzle__01__python | Sorting | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nGiven a list of phrases, generate a list of Before and After puzzles.\n\... |
maximum-number-of-ones | maximum-number-of-ones__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\nConsider a matrix M with dimensions width * height, such that every cell... |
maximum-number-of-balloons | maximum-number-of-balloons__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 text, you want to use the characters of text to form as m... |
reverse-substrings-between-each-pair-of-parentheses | reverse-substrings-between-each-pair-of-parentheses__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 that consists of lower case English letters and... |
reverse-substrings-between-each-pair-of-parentheses | reverse-substrings-between-each-pair-of-parentheses__02__python | String | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a string s that consists of lower case English letters and... |
k-concatenation-maximum-sum | k-concatenation-maximum-sum__01__python | Dynamic Programming | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nGiven an integer array arr and an integer k, modify the array by repeati... |
critical-connections-in-a-network | critical-connections-in-a-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\nThere are n servers numbered from 0 to n - 1 connected by undirected ser... |
how-many-apples-can-you-put-into-the-basket | how-many-apples-can-you-put-into-the-basket__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 some apples and a basket that can carry up to 5000 units of wei... |
find-smallest-common-element-in-all-rows | find-smallest-common-element-in-all-rows__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 m x n matrix mat where every row is sorted in strictly increasi... |
sort-items-by-groups-respecting-dependencies | sort-items-by-groups-respecting-dependencies__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\nThere are n items each belonging to zero or one of m groups where group[... |
unique-number-of-occurrences | unique-number-of-occurrences__01__python | Hash Table | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nGiven an array of integers arr, return true if the number of occurrences... |
get-equal-substrings-within-budget | get-equal-substrings-within-budget__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 two strings s and t of the same length and an integer maxC... |
get-equal-substrings-within-budget | get-equal-substrings-within-budget__03__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 strings s and t of the same length and an integer maxC... |
minimum-moves-to-reach-target-with-rotations | minimum-moves-to-reach-target-with-rotations__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\nIn an n*n grid, there is a snake that spans 2 cells and starts moving fr... |
stepping-numbers | stepping-numbers__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\nA stepping number is an integer such that all of its adjacent digits hav... |
valid-palindrome-iii | valid-palindrome-iii__01__python | Dynamic Programming | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nGiven a string s and an integer k, return true if s is a k-palindrome.\n... |
minimum-cost-to-move-chips-to-the-same-position | minimum-cost-to-move-chips-to-the-same-position__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 have n chips, where the position of the ith chip is position[i].\n\nW... |
count-vowels-permutation | count-vowels-permutation__01__python | Dynamic Programming | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nGiven an integer n, your task is to count how many strings of length n c... |
count-vowels-permutation | count-vowels-permutation__02__python | Recursion | true | [
{
"role": "system",
"content": "You 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, your task is to count how many strings of length n c... |
split-a-string-in-balanced-strings | split-a-string-in-balanced-strings__01__python | Greedy | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nBalanced strings are those that have an equal quantity of 'L' and 'R' ch... |
queens-that-can-attack-the-king | queens-that-can-attack-the-king__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\nOn a 0-indexed 8 x 8 chessboard, there can be multiple black queens and ... |
dice-roll-simulation | dice-roll-simulation__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\nA die simulator generates a random number from 1 to 6 for each roll. You... |
dice-roll-simulation | dice-roll-simulation__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\nA die simulator generates a random number from 1 to 6 for each roll. You... |
maximum-equal-frequency | maximum-equal-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 an array nums of positive integers, return the longest possible le... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.