slug
stringlengths
4
77
solution_id
stringlengths
16
89
primary_algorithm
stringclasses
22 values
verified
bool
1 class
messages
listlengths
3
3
restore-ip-addresses
restore-ip-addresses__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 valid IP address consists of exactly four integers separated by single...
binary-tree-inorder-traversal
binary-tree-inorder-traversal__01__python
Recursion
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven the root of a binary tree, return the inorder traversal of its nod...
binary-tree-inorder-traversal
binary-tree-inorder-traversal__02__python
Recursion
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven the root of a binary tree, return the inorder traversal of its nod...
binary-tree-inorder-traversal
binary-tree-inorder-traversal__03__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 inorder traversal of its nod...
unique-binary-search-trees
unique-binary-search-trees__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an integer n, return the number of structurally unique BST's (bina...
interleaving-string
interleaving-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\nGiven strings s1, s2, and s3, find whether s3 is formed by an interleavi...
interleaving-string
interleaving-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\nGiven strings s1, s2, and s3, find whether s3 is formed by an interleavi...
validate-binary-search-tree
validate-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\nGiven the root of a binary tree, determine if it is a valid binary searc...
same-tree
same-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 roots of two binary trees p and q, write a function to check i...
same-tree
same-tree__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\nGiven the roots of two binary trees p and q, write a function to check i...
symmetric-tree
symmetric-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\nGiven the root of a binary tree, check whether it is a mirror of itself ...
binary-tree-level-order-traversal
binary-tree-level-order-traversal__01__python
BFS
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven the root of a binary tree, return the level order traversal of its...
binary-tree-zigzag-level-order-traversal
binary-tree-zigzag-level-order-traversal__01__python
BFS
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven the root of a binary tree, return the zigzag level order traversal...
maximum-depth-of-binary-tree
maximum-depth-of-binary-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\nGiven the root of a binary tree, return its maximum depth.\n\nA binary t...
binary-tree-level-order-traversal-ii
binary-tree-level-order-traversal-ii__01__python
BFS
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven the root of a binary tree, return the bottom-up level order traver...
balanced-binary-tree
balanced-binary-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\nGiven a binary tree, determine if it is height-balanced.\n\n### Examples...
minimum-depth-of-binary-tree
minimum-depth-of-binary-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\nGiven a binary tree, find its minimum depth.\n\nThe minimum depth is the...
minimum-depth-of-binary-tree
minimum-depth-of-binary-tree__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\nGiven a binary tree, find its minimum depth.\n\nThe minimum depth is the...
path-sum
path-sum__01__python
Recursion
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven the root of a binary tree and an integer targetSum, return true if...
path-sum-ii
path-sum-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\nGiven the root of a binary tree and an integer targetSum, return all roo...
distinct-subsequences
distinct-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 two strings s and t, return the number of distinct subsequences of...
distinct-subsequences
distinct-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 two strings s and t, return the number of distinct subsequences of...
pascals-triangle-ii
pascals-triangle-ii__01__python
Recursion
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an integer rowIndex, return the rowIndexth (0-indexed) row of the ...
triangle
triangle__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 triangle array, return the minimum path sum from top to bottom.\...
triangle
triangle__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 triangle array, return the minimum path sum from top to bottom.\...
best-time-to-buy-and-sell-stock
best-time-to-buy-and-sell-stock__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 array prices where prices[i] is the price of a given st...
best-time-to-buy-and-sell-stock-ii
best-time-to-buy-and-sell-stock-ii__02__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array prices where prices[i] is the price of a ...
best-time-to-buy-and-sell-stock-ii
best-time-to-buy-and-sell-stock-ii__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 prices where prices[i] is the price of a ...
best-time-to-buy-and-sell-stock-iii
best-time-to-buy-and-sell-stock-iii__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an array prices where prices[i] is the price of a given st...
binary-tree-maximum-path-sum
binary-tree-maximum-path-sum__01__python
Recursion
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nA path in a binary tree is a sequence of nodes where each pair of adjace...
word-ladder-ii
word-ladder-ii__01__python
Backtracking
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nA transformation sequence from word beginWord to word endWord using a di...
word-ladder
word-ladder__01__python
BFS
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nA transformation sequence from word beginWord to word endWord using a di...
word-ladder
word-ladder__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\nA transformation sequence from word beginWord to word endWord using a di...
longest-consecutive-sequence
longest-consecutive-sequence__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 unsorted array of integers nums, return the length of the longe...
longest-consecutive-sequence
longest-consecutive-sequence__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\nGiven an unsorted array of integers nums, return the length of the longe...
sum-root-to-leaf-numbers
sum-root-to-leaf-numbers__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 containing digits from 0 to 9 on...
palindrome-partitioning
palindrome-partitioning__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 string s, partition s such that every substring of the partition...
palindrome-partitioning-ii
palindrome-partitioning-ii__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a string s, partition s such that every substring of the partition...
gas-station
gas-station__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 gas stations along a circular route, where the amount of gas...
candy
candy__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 children standing in a line. Each child is assigned a rating...
single-number-ii
single-number-ii__01__python
Bit Manipulation
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums where every element appears three times exce...
single-number-ii
single-number-ii__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 an integer array nums where every element appears three times exce...
word-break
word-break__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 a dictionary of strings wordDict, return true if s ...
word-break
word-break__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 a dictionary of strings wordDict, return true if s ...
binary-tree-preorder-traversal
binary-tree-preorder-traversal__01__python
Recursion
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven the root of a binary tree, return the preorder traversal of its no...
binary-tree-preorder-traversal
binary-tree-preorder-traversal__02__python
Recursion
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven the root of a binary tree, return the preorder traversal of its no...
binary-tree-preorder-traversal
binary-tree-preorder-traversal__03__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 preorder traversal of its no...
binary-tree-postorder-traversal
binary-tree-postorder-traversal__01__python
Recursion
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven the root of a binary tree, return the postorder traversal of its n...
binary-tree-postorder-traversal
binary-tree-postorder-traversal__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 postorder traversal of its n...
binary-tree-postorder-traversal
binary-tree-postorder-traversal__03__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 postorder traversal of its n...
insertion-sort-list
insertion-sort-list__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 the head of a singly linked list, sort the list using insertion so...
sort-list
sort-list__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 the head of a linked list, return the list after sorting it in asc...
max-points-on-a-line
max-points-on-a-line__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 array of points where points[i] = [xi, yi] represents a point o...
max-points-on-a-line
max-points-on-a-line__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\nGiven an array of points where points[i] = [xi, yi] represents a point o...
evaluate-reverse-polish-notation
evaluate-reverse-polish-notation__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 array of strings tokens that represents an arithmetic e...
evaluate-reverse-polish-notation
evaluate-reverse-polish-notation__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 array of strings tokens that represents an arithmetic e...
reverse-words-in-a-string
reverse-words-in-a-string__01__python
Two Pointers
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an input string s, reverse the order of the words.\n\nA word is de...
reverse-words-in-a-string
reverse-words-in-a-string__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 input string s, reverse the order of the words.\n\nA word is de...
maximum-product-subarray
maximum-product-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 an integer array nums, find a subarray that has the largest produc...
find-minimum-in-rotated-sorted-array
find-minimum-in-rotated-sorted-array__01__python
Binary Search
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nSuppose an array of length n sorted in ascending order is rotated betwee...
find-minimum-in-rotated-sorted-array-ii
find-minimum-in-rotated-sorted-array-ii__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\nSuppose an array of length n sorted in ascending order is rotated betwee...
longest-substring-with-at-most-two-distinct-characters
longest-substring-with-at-most-two-distinct-characters__01__python
Sliding Window
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a string s, return the length of the longest substring that contai...
one-edit-distance
one-edit-distance__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 both one edit distanc...
find-peak-element
find-peak-element__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\nA peak element is an element that is strictly greater than its neighbors...
maximum-gap
maximum-gap__01__python
Sorting
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums, return the maximum difference between two s...
compare-version-numbers
compare-version-numbers__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 version strings, version1 and version2, compare them. A versio...
fraction-to-recurring-decimal
fraction-to-recurring-decimal__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 two integers representing the numerator and denominator of a fract...
two-sum-ii-input-array-is-sorted
two-sum-ii-input-array-is-sorted__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 a 1-indexed array of integers numbers that is already sorted in no...
excel-sheet-column-title
excel-sheet-column-title__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 columnNumber, return its corresponding column title as ...
majority-element
majority-element__01__python
Divide and Conquer
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an array nums of size n, return the majority element.\n\nThe major...
excel-sheet-column-number
excel-sheet-column-number__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a string columnTitle that represents the column title as appears i...
factorial-trailing-zeroes
factorial-trailing-zeroes__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 trailing zeroes in n!.\n\nNote ...
dungeon-game
dungeon-game__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nThe demons had captured the princess and imprisoned her in the bottom-ri...
reverse-words-in-a-string-ii
reverse-words-in-a-string-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 character array s, reverse the order of the words.\n\nA word is ...
repeated-dna-sequences
repeated-dna-sequences__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\nThe DNA sequence is composed of a series of nucleotides abbreviated as '...
best-time-to-buy-and-sell-stock-iv
best-time-to-buy-and-sell-stock-iv__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 prices where prices[i] is the price of a ...
best-time-to-buy-and-sell-stock-iv
best-time-to-buy-and-sell-stock-iv__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 prices where prices[i] is the price of a ...
best-time-to-buy-and-sell-stock-iv
best-time-to-buy-and-sell-stock-iv__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 prices where prices[i] is the price of a ...
rotate-array
rotate-array__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, rotate the array to the right by k steps, w...
reverse-bits
reverse-bits__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\nReverse bits of a given 32 bits signed integer.\n\n### Examples\nInput: ...
number-of-1-bits
number-of-1-bits__01__python
Divide and Conquer
true
[ { "role": "system", "content": "You 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, write a function that returns the number of ...
number-of-1-bits
number-of-1-bits__02__python
Divide and Conquer
true
[ { "role": "system", "content": "You 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, write a function that returns the number of ...
house-robber
house-robber__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 a professional robber planning to rob houses along a street. Eac...
house-robber
house-robber__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 a professional robber planning to rob houses along a street. Eac...
house-robber
house-robber__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 a professional robber planning to rob houses along a street. Eac...
binary-tree-right-side-view
binary-tree-right-side-view__01__python
BFS
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven the root of a binary tree, imagine yourself standing on the right ...
binary-tree-right-side-view
binary-tree-right-side-view__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, imagine yourself standing on the right ...
bitwise-and-of-numbers-range
bitwise-and-of-numbers-range__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 that represent the range [left, right]...
happy-number
happy-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\nWrite an algorithm to determine if a number n is happy.\n\nA happy numbe...
happy-number
happy-number__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\nWrite an algorithm to determine if a number n is happy.\n\nA happy numbe...
remove-linked-list-elements
remove-linked-list-elements__01__python
Linked List
true
[ { "role": "system", "content": "You 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 linked list and an integer val, remove all the nodes...
count-primes
count-primes__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 prime numbers that are strictly...
isomorphic-strings
isomorphic-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 t, determine if they are isomorphic.\n\nTwo stri...
isomorphic-strings
isomorphic-strings__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\nGiven two strings s and t, determine if they are isomorphic.\n\nTwo stri...
reverse-linked-list
reverse-linked-list__01__python
Linked List
true
[ { "role": "system", "content": "You 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, reverse the list, and return the...
reverse-linked-list
reverse-linked-list__02__python
Recursion
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven the head of a singly linked list, reverse the list, and return the...
course-schedule
course-schedule__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 a total of numCourses courses you have to take, labeled from 0...
minimum-size-subarray-sum
minimum-size-subarray-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\nGiven an array of positive integers nums and a positive integer target, ...
house-robber-ii
house-robber-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 a professional robber planning to rob houses along a street. Eac...
shortest-palindrome
shortest-palindrome__01__python
String
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a string s. You can convert s to a palindrome by adding ch...