slug stringlengths 4 77 | solution_id stringlengths 16 89 | primary_algorithm stringclasses 22
values | verified bool 1
class | messages listlengths 3 3 |
|---|---|---|---|---|
equal-row-and-column-pairs | equal-row-and-column-pairs__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 n x n integer matrix grid, return the number of pairs ... |
number-of-excellent-pairs | number-of-excellent-pairs__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 a 0-indexed positive integer array nums and a positive int... |
maximum-number-of-books-you-can-take | maximum-number-of-books-you-can-take__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 books of length n where books[i]... |
make-array-zero-by-subtracting-equal-amounts | make-array-zero-by-subtracting-equal-amounts__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 non-negative integer array nums. In one operation, you m... |
find-closest-node-to-given-two-nodes | find-closest-node-to-given-two-nodes__01__python | BFS | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a directed graph of n nodes numbered from 0 to n - 1, wher... |
longest-cycle-in-a-graph | longest-cycle-in-a-graph__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 directed graph of n nodes numbered from 0 to n - 1, wher... |
minimum-costs-using-the-train-line | minimum-costs-using-the-train-line__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\nA train line going through a city has two routes, the regular route and ... |
count-number-of-bad-pairs | count-number-of-bad-pairs__01__python | Hash Table | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed integer array nums. A pair of indices (i, j) i... |
task-scheduler-ii | task-scheduler-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 a 0-indexed array of positive integers tasks, representing... |
minimum-replacements-to-sort-the-array | minimum-replacements-to-sort-the-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 a 0-indexed integer array nums. In one operation you can r... |
number-of-arithmetic-triplets | number-of-arithmetic-triplets__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 a 0-indexed, strictly increasing integer array nums and a ... |
reachable-nodes-with-restrictions | reachable-nodes-with-restrictions__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 and n -... |
reachable-nodes-with-restrictions | reachable-nodes-with-restrictions__02__python | BFS | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nThere is an undirected tree with n nodes labeled from 0 to n - 1 and n -... |
check-if-there-is-a-valid-partition-for-the-array | check-if-there-is-a-valid-partition-for-the-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 a 0-indexed integer array nums. You have to partition the ... |
check-if-there-is-a-valid-partition-for-the-array | check-if-there-is-a-valid-partition-for-the-array__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 integer array nums. You have to partition the ... |
minimize-maximum-value-in-a-grid | minimize-maximum-value-in-a-grid__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 an m x n integer matrix grid containing distinct positive ... |
largest-local-values-in-a-matrix | largest-local-values-in-a-matrix__01__python | Array | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an n x n integer matrix grid.\n\nGenerate an integer matri... |
node-with-highest-edge-score | node-with-highest-edge-score__01__python | Graph | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a directed graph with n nodes labeled from 0 to n - 1, whe... |
count-special-integers | count-special-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\nWe call a positive integer special if all of its digits are distinct.\n\... |
choose-edges-to-maximize-score-in-a-tree | choose-edges-to-maximize-score-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\nYou are given a weighted tree consisting of n nodes numbered from 0 to n... |
minimum-recolors-to-get-k-consecutive-black-blocks | minimum-recolors-to-get-k-consecutive-black-blocks__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 string blocks of length n, where blocks[i] is ... |
time-needed-to-rearrange-a-binary-string | time-needed-to-rearrange-a-binary-string__01__python | Dynamic Programming | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a binary string s. In one second, all occurrences of \"01\... |
time-needed-to-rearrange-a-binary-string | time-needed-to-rearrange-a-binary-string__02__python | Dynamic Programming | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a binary string s. In one second, all occurrences of \"01\... |
shifting-letters-ii | shifting-letters-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 string s of lowercase English letters and a 2D integer a... |
maximum-segment-sum-after-removals | maximum-segment-sum-after-removals__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 integer arrays nums and removeQueries, both ... |
largest-palindromic-number | largest-palindromic-number__01__python | Greedy | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a string num consisting of digits only.\n\nReturn the larg... |
amount-of-time-for-binary-tree-to-be-infected | amount-of-time-for-binary-tree-to-be-infected__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 the root of a binary tree with unique values, and an integ... |
longest-subsequence-with-limited-sum | longest-subsequence-with-limited-sum__02__python | Two Pointers | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer array nums of length n, and an integer array qu... |
removing-stars-from-a-string | removing-stars-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\nYou are given a string s, which contains stars *.\n\nIn one operation, y... |
minimum-amount-of-time-to-collect-garbage | minimum-amount-of-time-to-collect-garbage__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 of strings garbage where garbage[i] repr... |
strictly-palindromic-number | strictly-palindromic-number__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\nAn integer n is strictly palindromic if, for every base b between 2 and ... |
maximum-number-of-robots-within-budget | maximum-number-of-robots-within-budget__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 have n robots. You are given two 0-indexed integer arrays, chargeTim... |
check-distances-between-same-letters | check-distances-between-same-letters__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 consisting of only lowercase English ... |
number-of-ways-to-reach-a-position-after-exactly-k-steps | number-of-ways-to-reach-a-position-after-exactly-k-steps__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 startPos and endPos. Initially, you ... |
longest-nice-subarray | longest-nice-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 an array nums consisting of positive integers.\n\nWe call ... |
minimum-time-to-kill-all-monsters | minimum-time-to-kill-all-monsters__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 power where power[i] is the power of the ... |
minimum-time-to-kill-all-monsters | minimum-time-to-kill-all-monsters__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 array power where power[i] is the power of the ... |
most-frequent-even-element | most-frequent-even-element__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 integer array nums, return the most frequent even element.\n\nI... |
longest-increasing-subsequence-ii | longest-increasing-subsequence-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 integer array nums and an integer k.\n\nFind the longes... |
count-days-spent-together | count-days-spent-together__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 traveling to Rome for separate business meetings.\n\nY... |
maximum-matching-of-players-with-trainers | maximum-matching-of-players-with-trainers__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 players, where players[i] repres... |
smallest-even-multiple | smallest-even-multiple__01__python | Math | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nGiven a positive integer n, return the smallest positive integer that is... |
reverse-odd-levels-of-binary-tree | reverse-odd-levels-of-binary-tree__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 perfect binary tree, reverse the node values at each... |
sum-of-prefix-scores-of-strings | sum-of-prefix-scores-of-strings__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 words of size n consisting of non-empty strings.\... |
closest-fair-integer | closest-fair-integer__01__python | Math | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a positive integer n.\n\nWe call an integer k fair if the ... |
sort-the-people | sort-the-people__01__python | Sorting | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an array of strings names, and an array heights that consi... |
sort-the-people | sort-the-people__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 an array of strings names, and an array heights that consi... |
longest-subarray-with-maximum-bitwise-and | longest-subarray-with-maximum-bitwise-and__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 integer array nums of size n.\n\nConsider a non-empty s... |
find-all-good-indices | find-all-good-indices__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\nYou are given a 0-indexed integer array nums of size n and a positive in... |
number-of-good-paths | number-of-good-paths__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 is a tree (i.e. a connected, undirected graph with no cycles) cons... |
merge-operations-to-turn-array-into-a-palindrome | merge-operations-to-turn-array-into-a-palindrome__01__python | Greedy | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an array nums consisting of positive integers.\n\nYou can ... |
remove-letter-to-equalize-frequency | remove-letter-to-equalize-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 a 0-indexed string word, consisting of lowercase English l... |
bitwise-xor-of-all-pairings | bitwise-xor-of-all-pairings__01__python | Bit Manipulation | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given two 0-indexed arrays, nums1 and nums2, consisting of non-n... |
number-of-pairs-satisfying-inequality | number-of-pairs-satisfying-inequality__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 two 0-indexed integer arrays nums1 and nums2, each of size... |
maximum-sum-of-an-hourglass | maximum-sum-of-an-hourglass__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 m x n integer matrix grid.\n\nWe define an hourglass as... |
minimize-xor | minimize-xor__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 two positive integers num1 and num2, find the positive integer x s... |
maximum-deletions-on-a-string | maximum-deletions-on-a-string__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 string s consisting of only lowercase English letters. I... |
maximum-deletions-on-a-string | maximum-deletions-on-a-string__02__python | Dynamic Programming | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a string s consisting of only lowercase English letters. I... |
maximize-total-tastiness-of-purchased-fruits | maximize-total-tastiness-of-purchased-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 two non-negative integer arrays price and tastiness, both ... |
the-employee-that-worked-on-the-longest-task | the-employee-that-worked-on-the-longest-task__01__python | Array | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nThere are n employees, each with a unique id from 0 to n - 1.\n\nYou are... |
using-a-robot-to-print-the-lexicographically-smallest-string | using-a-robot-to-print-the-lexicographically-smallest-string__01__python | Greedy | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a string s and a robot that currently holds an empty strin... |
number-of-valid-clock-times | number-of-valid-clock-times__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 of length 5 called time, representing the current... |
number-of-valid-clock-times | number-of-valid-clock-times__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 of length 5 called time, representing the current... |
range-product-queries-of-powers | range-product-queries-of-powers__01__python | Bit Manipulation | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nGiven a positive integer n, there exists a 0-indexed array called powers... |
minimize-maximum-of-array | minimize-maximum-of-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\nYou are given a 0-indexed array nums comprising of n non-negative intege... |
create-components-with-same-value | create-components-with-same-value__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.\n\nYou... |
largest-positive-integer-that-exists-with-its-negative | largest-positive-integer-that-exists-with-its-negative__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 integer array nums that does not contain any zeros, find the la... |
count-number-of-distinct-integers-after-reverse-operations | count-number-of-distinct-integers-after-reverse-operations__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\nYou have... |
sum-of-number-and-its-reverse | sum-of-number-and-its-reverse__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 a non-negative integer num, return true if num can be expressed as... |
count-subarrays-with-fixed-bounds | count-subarrays-with-fixed-bounds__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 an integer array nums and two integers minK and maxK.\n\nA... |
number-of-nodes-with-value-one | number-of-nodes-with-value-one__01__python | Math | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nThere is an undirected connected tree with n nodes labeled from 1 to n a... |
determine-if-two-events-have-conflict | determine-if-two-events-have-conflict__01__python | Array | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given two arrays of strings that represent two inclusive events ... |
minimum-cost-to-make-array-equal | minimum-cost-to-make-array-equal__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 0-indexed arrays nums and cost consisting each of n po... |
minimum-cost-to-make-array-equal | minimum-cost-to-make-array-equal__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 two 0-indexed arrays nums and cost consisting each of n po... |
minimum-number-of-operations-to-make-arrays-similar | minimum-number-of-operations-to-make-arrays-similar__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 positive integer arrays nums and target, of the same l... |
number-of-distinct-binary-strings-after-applying-operations | number-of-distinct-binary-strings-after-applying-operations__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 binary string s and a positive integer k.\n\nYou can app... |
words-within-two-edits-of-dictionary | words-within-two-edits-of-dictionary__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 two string arrays, queries and dictionary. All words in ea... |
destroy-sequential-targets | destroy-sequential-targets__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, re... |
next-greater-element-iv | next-greater-element-iv__02__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 a 0-indexed array of non-negative integers nums. For each ... |
average-value-of-even-numbers-that-are-divisible-by-three | average-value-of-even-numbers-that-are-divisible-by-three__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 of positive integers, return the average val... |
most-popular-video-creator | most-popular-video-creator__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 string arrays creators and ids, and an integer array v... |
minimum-addition-to-make-integer-beautiful | minimum-addition-to-make-integer-beautiful__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 positive integers n and target.\n\nAn integer is consi... |
sort-array-by-moving-items-to-empty-space | sort-array-by-moving-items-to-empty-space__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 containing each element fr... |
apply-operations-to-an-array | apply-operations-to-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 a 0-indexed array nums of size n consisting of non-negativ... |
maximum-sum-of-distinct-subarrays-with-length-k | maximum-sum-of-distinct-subarrays-with-length-k__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 an integer k. Find the maximum s... |
minimum-total-distance-traveled | minimum-total-distance-traveled__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 are some robots and factories on the X-axis. You are given an inte... |
number-of-distinct-averages | number-of-distinct-averages__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 even length.\n\nAs long ... |
number-of-distinct-averages | number-of-distinct-averages__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 of even length.\n\nAs long ... |
count-ways-to-build-good-strings | count-ways-to-build-good-strings__01__python | Memoization | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nGiven the integers zero, one, low, and high, we can construct a string b... |
most-profitable-path-in-a-tree | most-profitable-path-in-a-tree__01__python | DFS | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nThere is an undirected tree with n nodes labeled from 0 to n - 1, rooted... |
split-message-based-on-limit | split-message-based-on-limit__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, message, and a positive integer, limit.\n\nYou m... |
convert-the-temperature | convert-the-temperature__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 non-negative floating point number rounded to two decima... |
minimum-number-of-operations-to-sort-a-binary-tree-by-level | minimum-number-of-operations-to-sort-a-binary-tree-by-level__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 the root of a binary tree with unique values.\n\nIn one op... |
maximum-number-of-non-overlapping-palindrome-substrings | maximum-number-of-non-overlapping-palindrome-substrings__01__python | Memoization | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a string s and a positive integer k.\n\nSelect a set of no... |
number-of-unequal-triplets-in-array | number-of-unequal-triplets-in-array__01__python | Brute Force | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed array of positive integers nums. Find the numb... |
number-of-unequal-triplets-in-array | number-of-unequal-triplets-in-array__03__python | Hash Table | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed array of positive integers nums. Find the numb... |
number-of-beautiful-partitions | number-of-beautiful-partitions__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 that consists of the digits '1' to '9' and two ... |
maximum-xor-of-two-non-overlapping-subtrees | maximum-xor-of-two-non-overlapping-subtrees__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... |
minimum-cuts-to-divide-a-circle | minimum-cuts-to-divide-a-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\nA valid cut in a circle can be:\n\n\tA cut that is represented by a stra... |
difference-between-ones-and-zeros-in-row-and-column | difference-between-ones-and-zeros-in-row-and-column__01__python | Math | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed m x n binary matrix grid.\n\nA 0-indexed m x n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.