slug stringlengths 4 77 | solution_id stringlengths 16 89 | primary_algorithm stringclasses 22
values | verified bool 1
class | messages listlengths 3 3 |
|---|---|---|---|---|
max-chunks-to-make-sorted | max-chunks-to-make-sorted__02__python | Greedy | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer array arr of length n that represents a permuta... |
jewels-and-stones | jewels-and-stones__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're given strings jewels representing the types of stones that are je... |
basic-calculator-iii | basic-calculator-iii__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\nImplement a basic calculator to evaluate a simple expression string.\n\n... |
sliding-puzzle | sliding-puzzle__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\nOn an 2 x 3 board, there are five tiles labeled from 1 to 5, and an empt... |
global-and-local-inversions | global-and-local-inversions__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 of length n which represents a permu... |
global-and-local-inversions | global-and-local-inversions__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\nYou are given an integer array nums of length n which represents a permu... |
k-th-symbol-in-grammar | k-th-symbol-in-grammar__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\nWe build a table of n rows (1-indexed). We start by writing 0 in the 1st... |
k-th-symbol-in-grammar | k-th-symbol-in-grammar__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\nWe build a table of n rows (1-indexed). We start by writing 0 in the 1st... |
reaching-points | reaching-points__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 four integers sx, sy, tx, and ty, return true if it is possible to... |
rabbits-in-forest | rabbits-in-forest__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 a forest with an unknown number of rabbits. We asked n rabbits ... |
transform-to-chessboard | transform-to-chessboard__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 n x n binary grid board. In each move, you can swap any... |
minimum-distance-between-bst-nodes | minimum-distance-between-bst-nodes__01__python | DFS | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nGiven the root of a Binary Search Tree (BST), return the minimum differe... |
is-graph-bipartite | is-graph-bipartite__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 graph with n nodes, where each node is numbered b... |
is-graph-bipartite | is-graph-bipartite__02__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 graph with n nodes, where each node is numbered b... |
cheapest-flights-within-k-stops | cheapest-flights-within-k-stops__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 are n cities connected by some number of flights. You are given an... |
cheapest-flights-within-k-stops | cheapest-flights-within-k-stops__02__python | Dynamic Programming | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nThere are n cities connected by some number of flights. You are given an... |
rotated-digits | rotated-digits__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\nAn integer x is a good if after rotating each digit individually by 180 ... |
rotated-digits | rotated-digits__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\nAn integer x is a good if after rotating each digit individually by 180 ... |
escape-the-ghosts | escape-the-ghosts__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 playing a simplified PAC-MAN game on an infinite 2-D grid. You s... |
domino-and-tromino-tiling | domino-and-tromino-tiling__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 two types of tiles: a 2 x 1 domino shape and a tromino shape. Y... |
number-of-matching-subsequences | number-of-matching-subsequences__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 array of strings words, return the number of wor... |
number-of-matching-subsequences | number-of-matching-subsequences__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 and an array of strings words, return the number of wor... |
valid-tic-tac-toe-state | valid-tic-tac-toe-state__01__python | Array | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nGiven a Tic-Tac-Toe board as a string array board, return true if and on... |
number-of-subarrays-with-bounded-maximum | number-of-subarrays-with-bounded-maximum__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 an integer array nums and two integers left and right, return the ... |
number-of-subarrays-with-bounded-maximum | number-of-subarrays-with-bounded-maximum__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\nGiven an integer array nums and two integers left and right, return the ... |
rotate-string | rotate-string__01__python | String | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nGiven two strings s and goal, return true if and only if s can become go... |
all-paths-from-source-to-target | all-paths-from-source-to-target__02__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\nGiven a directed acyclic graph (DAG) of n nodes labeled from 0 to n - 1,... |
smallest-rotation-with-highest-score | smallest-rotation-with-highest-score__01__python | Array | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an array nums. You can rotate it by a non-negative integer... |
champagne-tower | champagne-tower__01__python | Math | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nWe stack glasses in a pyramid, where the first row has 1 glass, the seco... |
champagne-tower | champagne-tower__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\nWe stack glasses in a pyramid, where the first row has 1 glass, the seco... |
similar-rgb-color | similar-rgb-color__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\nThe red-green-blue color \"#AABBCC\" can be written as \"#ABC\" in short... |
minimum-swaps-to-make-sequences-increasing | minimum-swaps-to-make-sequences-increasing__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 integer arrays of the same length nums1 and nums2. In ... |
find-eventual-safe-states | find-eventual-safe-states__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 a directed graph of n nodes with each node labeled from 0 to n ... |
find-eventual-safe-states | find-eventual-safe-states__02__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 a directed graph of n nodes with each node labeled from 0 to n ... |
unique-morse-code-words | unique-morse-code-words__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\nInternational Morse Code defines a standard encoding where each letter i... |
split-array-with-same-average | split-array-with-same-average__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 array nums.\n\nYou should move each element of ... |
number-of-lines-to-write-string | number-of-lines-to-write-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 of lowercase English letters and an array width... |
max-increase-to-keep-city-skyline | max-increase-to-keep-city-skyline__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 a city composed of n x n blocks, where each block contains a si... |
soup-servings | soup-servings__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 have two soups, A and B, each starting with n mL. On every turn, one... |
expressive-words | expressive-words__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\nSometimes people repeat letters to represent extra feeling. For example:... |
bus-routes | bus-routes__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 array routes representing bus routes where routes[i] is... |
ambiguous-coordinates | ambiguous-coordinates__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\nWe had some 2-dimensional coordinates, like \"(1, 3)\" or \"(2, 0.5)\". ... |
race-car | race-car__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\nYour car starts at position 0 and speed +1 on an infinite number line. Y... |
short-encoding-of-words | short-encoding-of-words__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\nA valid encoding of an array of words is any reference string s and arra... |
short-encoding-of-words | short-encoding-of-words__02__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\nA valid encoding of an array of words is any reference string s and arra... |
shortest-distance-to-a-character | shortest-distance-to-a-character__01__python | Two Pointers | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nGiven a string s and a character c that occurs in s, return an array of ... |
binary-trees-with-factors | binary-trees-with-factors__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 unique integers, arr, where each integer arr[i] is str... |
goat-latin | goat-latin__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 sentence that consist of words separated by space... |
friends-of-appropriate-ages | friends-of-appropriate-ages__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\nThere are n persons on a social media website. You are given an integer ... |
most-profit-assigning-work | most-profit-assigning-work__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 jobs and m workers. You are given three arrays: difficulty, p... |
most-profit-assigning-work | most-profit-assigning-work__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 jobs and m workers. You are given three arrays: difficulty, p... |
consecutive-numbers-sum | consecutive-numbers-sum__01__python | Math | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nGiven an integer n, return the number of ways you can write n as the sum... |
positions-of-large-groups | positions-of-large-groups__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\nIn a string s of lowercase letters, these letters form consecutive group... |
masking-personal-information | masking-personal-information__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 personal information string s, representing either an em... |
flipping-an-image | flipping-an-image__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 an n x n binary matrix image, flip the image horizontally, then in... |
find-and-replace-in-string | find-and-replace-in-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 0-indexed string s that you must perform k replacement o... |
sum-of-distances-in-tree | sum-of-distances-in-tree__01__python | Dynamic Programming | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nThere is an undirected connected tree with n nodes labeled from 0 to n -... |
image-overlap | image-overlap__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 images, img1 and img2, represented as binary, square m... |
rectangle-overlap | rectangle-overlap__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 axis-aligned rectangle is represented as a list [x1, y1, x2, y2], whe... |
push-dominoes | push-dominoes__01__python | BFS | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nThere are n dominoes in a line, and we place each domino vertically upri... |
similar-string-groups | similar-string-groups__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\nTwo strings, X and Y, are considered similar if either they are identica... |
keys-and-rooms | keys-and-rooms__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 rooms labeled from 0 to n - 1 and all the rooms are locked e... |
keys-and-rooms | keys-and-rooms__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 are n rooms labeled from 0 to n - 1 and all the rooms are locked e... |
split-array-into-fibonacci-sequence | split-array-into-fibonacci-sequence__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 of digits num, such as \"123456579\". We can spli... |
backspace-string-compare | backspace-string-compare__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 two strings s and t, return true if they are equal when both are t... |
hand-of-straights | hand-of-straights__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\nAlice has some number of cards and she wants to rearrange the cards into... |
shortest-path-visiting-all-nodes | shortest-path-visiting-all-nodes__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 an undirected, connected graph of n nodes labeled from 0 to n -... |
rectangle-area-ii | rectangle-area-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 2D array of axis-aligned rectangles. Each rectangle[i] =... |
loud-and-rich | loud-and-rich__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 a group of n people labeled from 0 to n - 1 where each person h... |
peak-index-in-a-mountain-array | peak-index-in-a-mountain-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 an integer mountain array arr of length n where the values... |
car-fleet | car-fleet__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 cars at given miles away from the starting mile 0, traveling... |
k-similar-strings | k-similar-strings__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\nStrings s1 and s2 are k-similar (for some non-negative integer k) if we ... |
score-of-parentheses | score-of-parentheses__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 balanced parentheses string s, return the score of the string.\n... |
buddy-strings | buddy-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\nGiven two strings s and goal, return true if you can swap two letters in... |
lemonade-change | lemonade-change__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\nAt a lemonade stand, each lemonade costs $5. Customers are standing in a... |
score-after-flipping-matrix | score-after-flipping-matrix__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 m x n binary matrix grid.\n\nA move consists of choosin... |
prime-palindrome | prime-palindrome__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 the smallest prime palindrome greater than or... |
binary-gap | binary-gap__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, find and return the longest distance between... |
reordered-power-of-2 | reordered-power-of-2__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. We reorder the digits in any order (includin... |
advantage-shuffle | advantage-shuffle__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 integer arrays nums1 and nums2 both of the same length... |
leaf-similar-trees | leaf-similar-trees__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\nConsider all the leaves of a binary tree, from left to right order, the ... |
walking-robot-simulation | walking-robot-simulation__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 robot on an infinite XY-plane starts at point (0, 0) facing north. The... |
middle-of-the-linked-list | middle-of-the-linked-list__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 the head of a singly linked list, return the middle node of the li... |
stone-game | stone-game__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\nAlice and Bob play a game with piles of stones. There are an even number... |
stone-game | stone-game__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\nAlice and Bob play a game with piles of stones. There are an even number... |
profitable-schemes | profitable-schemes__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 is a group of n members, and a list of various crimes they could c... |
profitable-schemes | profitable-schemes__02__python | Dynamic Programming | true | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution."
},
{
"role": "user",
"content": "### Problem\nThere is a group of n members, and a list of various crimes they could c... |
decoded-string-at-index | decoded-string-at-index__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 an encoded string s. To decode the string to a tape, the e... |
boats-to-save-people | boats-to-save-people__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 people where people[i] is the weight of the ith p... |
projection-area-of-3d-shapes | projection-area-of-3d-shapes__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 n x n grid where we place some 1 x 1 x 1 cubes that are... |
uncommon-words-from-two-sentences | uncommon-words-from-two-sentences__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\nA sentence is a string of single-space separated words where each word c... |
spiral-matrix-iii | spiral-matrix-iii__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 start at the cell (rStart, cStart) of an rows x cols grid facing eas... |
possible-bipartition | possible-bipartition__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\nWe want to split a group of n people (labeled from 1 to n) into two grou... |
possible-bipartition | possible-bipartition__02__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\nWe want to split a group of n people (labeled from 1 to n) into two grou... |
fair-candy-swap | fair-candy-swap__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\nAlice and Bob have a different total number of candies. You are given tw... |
find-and-replace-pattern | find-and-replace-pattern__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 strings words and a string pattern, return a list of wor... |
surface-area-of-3d-shapes | surface-area-of-3d-shapes__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 n x n grid where you have placed some 1 x 1 x 1 cubes. ... |
groups-of-special-equivalent-strings | groups-of-special-equivalent-strings__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 of the same length words.\n\nIn one mo... |
bitwise-ors-of-subarrays | bitwise-ors-of-subarrays__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 arr, return the number of distinct bitwise ORs of... |
orderly-queue | orderly-queue__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 string s and an integer k. You can choose one of the fir... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.