slug
stringlengths
4
77
solution_id
stringlengths
16
89
primary_algorithm
stringclasses
22 values
verified
bool
1 class
messages
listlengths
3
3
set-mismatch
set-mismatch__03__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 have a set of integers s, which originally contains all the numbers ...
maximum-length-of-pair-chain
maximum-length-of-pair-chain__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 of n pairs pairs where pairs[i] = [lefti, righti]...
palindromic-substrings
palindromic-substrings__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 number of palindromic substrings in it.\n\n...
palindromic-substrings
palindromic-substrings__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, return the number of palindromic substrings in it.\n\n...
replace-words
replace-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\nIn English, we have a concept called root, which can be followed by some...
dota2-senate
dota2-senate__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 the world of Dota2, there are two parties: the Radiant and the Dire.\...
2-keys-keyboard
2-keys-keyboard__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 only one character 'A' on the screen of a notepad. You can perf...
2-keys-keyboard
2-keys-keyboard__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 only one character 'A' on the screen of a notepad. You can perf...
4-keys-keyboard
4-keys-keyboard__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\nImagine you have a special keyboard with the following keys:\n\n\tA: Pri...
two-sum-iv-input-is-a-bst
two-sum-iv-input-is-a-bst__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 root of a binary search tree and an integer k, return true if ...
two-sum-iv-input-is-a-bst
two-sum-iv-input-is-a-bst__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 the root of a binary search tree and an integer k, return true if ...
print-binary-tree
print-binary-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\nGiven the root of a binary tree, construct a 0-indexed m x n string matr...
print-binary-tree
print-binary-tree__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\nGiven the root of a binary tree, construct a 0-indexed m x n string matr...
coin-path
coin-path__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 coins (1-indexed) of length n and an inte...
find-k-closest-elements
find-k-closest-elements__01__python
Sorting
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a sorted integer array arr, two integers k and x, return the k clo...
find-k-closest-elements
find-k-closest-elements__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\nGiven a sorted integer array arr, two integers k and x, return the k clo...
find-k-closest-elements
find-k-closest-elements__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\nGiven a sorted integer array arr, two integers k and x, return the k clo...
image-smoother
image-smoother__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\nAn image smoother is a filter of the size 3 x 3 that can be applied to e...
maximum-width-of-binary-tree
maximum-width-of-binary-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\nGiven the root of a binary tree, return the maximum width of the given t...
maximum-width-of-binary-tree
maximum-width-of-binary-tree__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\nGiven the root of a binary tree, return the maximum width of the given t...
equal-tree-partition
equal-tree-partition__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 true if you can partition the tr...
strange-printer
strange-printer__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nThere is a strange printer with the following two special properties:\n\...
kth-smallest-number-in-multiplication-table
kth-smallest-number-in-multiplication-table__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\nNearly everyone has used the Multiplication Table. The multiplication ta...
maximum-swap
maximum-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\nYou are given an integer num. You can swap two digits at most once to ge...
second-minimum-node-in-a-binary-tree
second-minimum-node-in-a-binary-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\nGiven a non-empty special binary tree consisting of nodes with the non-n...
bulb-switcher-ii
bulb-switcher-ii__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 room with n bulbs labeled from 1 to n that all are turned on ...
number-of-longest-increasing-subsequence
number-of-longest-increasing-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 an integer array nums, return the number of longest increasing sub...
longest-continuous-increasing-subsequence
longest-continuous-increasing-subsequence__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 unsorted array of integers nums, return the length of the longe...
longest-continuous-increasing-subsequence
longest-continuous-increasing-subsequence__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 unsorted array of integers nums, return the length of the longe...
valid-parenthesis-string
valid-parenthesis-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\nGiven a string s containing only three types of characters: '(', ')' and...
valid-parenthesis-string
valid-parenthesis-string__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\nGiven a string s containing only three types of characters: '(', ')' and...
24-game
24-game__01__python
DFS
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array cards of length 4. You have four cards, e...
valid-palindrome-ii
valid-palindrome-ii__01__python
Two Pointers
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a string s, return true if the s can be palindrome after deleting ...
next-closest-time
next-closest-time__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\nGiven a time represented in the format \"HH:MM\", form the next closest ...
redundant-connection
redundant-connection__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\nIn this problem, a tree is an undirected graph that is connected and has...
redundant-connection
redundant-connection__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\nIn this problem, a tree is an undirected graph that is connected and has...
redundant-connection-ii
redundant-connection-ii__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\nIn this problem, a rooted tree is a directed graph such that, there is e...
redundant-connection-ii
redundant-connection-ii__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\nIn this problem, a rooted tree is a directed graph such that, there is e...
longest-univalue-path
longest-univalue-path__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 length of the longest path, ...
maximum-sum-of-3-non-overlapping-subarrays
maximum-sum-of-3-non-overlapping-subarrays__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 an integer array nums and an integer k, find three non-overlapping...
top-k-frequent-words
top-k-frequent-words__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 array of strings words and an integer k, return the k most freq...
binary-number-with-alternating-bits
binary-number-with-alternating-bits__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a positive integer, check whether it has alternating bits: namely,...
binary-number-with-alternating-bits
binary-number-with-alternating-bits__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\nGiven a positive integer, check whether it has alternating bits: namely,...
number-of-distinct-islands
number-of-distinct-islands__01__python
DFS
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an m x n binary matrix grid. An island is a group of 1's (...
count-binary-substrings
count-binary-substrings__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 binary string s, return the number of non-empty substrings that ...
degree-of-an-array
degree-of-an-array__01__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a non-empty array of non-negative integers nums, the degree of thi...
partition-to-k-equal-sum-subsets
partition-to-k-equal-sum-subsets__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 an integer array nums and an integer k, return true if it is possi...
partition-to-k-equal-sum-subsets
partition-to-k-equal-sum-subsets__02__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 an integer array nums and an integer k, return true if it is possi...
partition-to-k-equal-sum-subsets
partition-to-k-equal-sum-subsets__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 integer array nums and an integer k, return true if it is possi...
falling-squares
falling-squares__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 several squares being dropped onto the X-axis of a 2D plane.\n...
search-in-a-binary-search-tree
search-in-a-binary-search-tree__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 the root of a binary search tree (BST) and an integer val....
binary-search
binary-search__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 integers nums which is sorted in ascending order, and ...
to-lower-case
to-lower-case__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 string s, return the string after replacing every uppercase lett...
number-of-distinct-islands-ii
number-of-distinct-islands-ii__01__python
DFS
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an m x n binary matrix grid. An island is a group of 1's (...
minimum-ascii-delete-sum-for-two-strings
minimum-ascii-delete-sum-for-two-strings__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 s1 and s2, return the lowest ASCII sum of deleted char...
subarray-product-less-than-k
subarray-product-less-than-k__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 array of integers nums and an integer k, return the number of c...
best-time-to-buy-and-sell-stock-with-transaction-fee
best-time-to-buy-and-sell-stock-with-transaction-fee__01__python
Memoization
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an array prices where prices[i] is the price of a given st...
best-time-to-buy-and-sell-stock-with-transaction-fee
best-time-to-buy-and-sell-stock-with-transaction-fee__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 prices where prices[i] is the price of a given st...
best-time-to-buy-and-sell-stock-with-transaction-fee
best-time-to-buy-and-sell-stock-with-transaction-fee__03__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an array prices where prices[i] is the price of a given st...
1-bit-and-2-bit-characters
1-bit-and-2-bit-characters__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\nWe have two special characters:\n\n\tThe first character can be represen...
maximum-length-of-repeated-subarray
maximum-length-of-repeated-subarray__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 integer arrays nums1 and nums2, return the maximum length of a...
longest-word-in-dictionary
longest-word-in-dictionary__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\nGiven an array of strings words representing an English Dictionary, retu...
remove-comments
remove-comments__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 C++ program, remove comments from it. The program source is an a...
candy-crush
candy-crush__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\nThis question is about implementing a basic elimination algorithm for Ca...
find-pivot-index
find-pivot-index__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 array of integers nums, calculate the pivot index of this array...
minimum-window-subsequence
minimum-window-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 strings s1 and s2, return the minimum contiguous substring part of...
self-dividing-numbers
self-dividing-numbers__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 self-dividing number is a number that is divisible by every digit it c...
count-different-palindromic-subsequences
count-different-palindromic-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, return the number of different non-empty palindromic s...
sentence-similarity
sentence-similarity__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\nWe can represent a sentence as an array of words, for example, the sente...
parse-lisp-expression
parse-lisp-expression__01__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a string expression representing a Lisp-like expression to...
sentence-similarity-ii
sentence-similarity-ii__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 can represent a sentence as an array of words, for example, the sente...
monotone-increasing-digits
monotone-increasing-digits__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\nAn integer has monotone increasing digits if and only if each pair of ad...
daily-temperatures
daily-temperatures__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 array of integers temperatures represents the daily temperature...
delete-and-earn
delete-and-earn__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. You want to maximize the number of ...
cherry-pickup
cherry-pickup__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 n x n grid representing a field of cherries, each cell ...
network-delay-time
network-delay-time__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 network of n nodes, labeled from 1 to n. You are also gi...
min-cost-climbing-stairs
min-cost-climbing-stairs__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 cost where cost[i] is the cost of ith ste...
min-cost-climbing-stairs
min-cost-climbing-stairs__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 cost where cost[i] is the cost of ith ste...
min-cost-climbing-stairs
min-cost-climbing-stairs__03__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array cost where cost[i] is the cost of ith ste...
shortest-completing-word
shortest-completing-word__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 licensePlate and an array of strings words, find the shor...
contain-virus
contain-virus__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\nA virus is spreading rapidly, and your task is to quarantine the infecte...
number-of-corner-rectangles
number-of-corner-rectangles__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 m x n integer matrix grid where each entry is only 0 or 1, retu...
open-the-lock
open-the-lock__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 have a lock in front of you with 4 circular wheels. Each wheel has 1...
open-the-lock
open-the-lock__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\nYou have a lock in front of you with 4 circular wheels. Each wheel has 1...
cracking-the-safe
cracking-the-safe__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 safe protected by a password. The password is a sequence of n...
reach-a-number
reach-a-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\nYou are standing at position 0 on an infinite number line. There is a de...
pour-water
pour-water__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 elevation map represents as an integer array heights wh...
set-intersection-size-at-least-two
set-intersection-size-at-least-two__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 2D integer array intervals where intervals[i] = [starti,...
bold-words-in-string
bold-words-in-string__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\nGiven an array of keywords words and a string s, make all appearances of...
find-anagram-mappings
find-anagram-mappings__01__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given two integer arrays nums1 and nums2 where nums2 is an anagr...
special-binary-string
special-binary-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\nSpecial binary strings are binary strings with the following two propert...
prime-number-of-set-bits-in-binary-representation
prime-number-of-set-bits-in-binary-representation__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 two integers left and right, return the count of numbers in the in...
partition-labels
partition-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 a string s. We want to partition the string into as many p...
largest-plus-sign
largest-plus-sign__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an integer n. You have an n x n binary grid grid with all ...
couples-holding-hands
couples-holding-hands__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 are n couples sitting in 2n seats arranged in a row and want to ho...
toeplitz-matrix
toeplitz-matrix__01__python
Array
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an m x n matrix, return true if the matrix is Toeplitz. Otherwise,...
reorganize-string
reorganize-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\nGiven a string s, rearrange the characters of s so that any two adjacent...
max-chunks-to-make-sorted-ii
max-chunks-to-make-sorted-ii__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array arr.\n\nWe split arr into some number of ...
max-chunks-to-make-sorted-ii
max-chunks-to-make-sorted-ii__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.\n\nWe split arr into some number of ...
max-chunks-to-make-sorted
max-chunks-to-make-sorted__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array arr of length n that represents a permuta...