slug
stringlengths
4
77
solution_id
stringlengths
16
89
primary_algorithm
stringclasses
22 values
verified
bool
1 class
messages
listlengths
3
3
power-of-four
power-of-four__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 n, return true if it is a power of four. Otherwise, ret...
integer-break
integer-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 an integer n, break it into the sum of k positive integers, where ...
integer-break
integer-break__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 integer n, break it into the sum of k positive integers, where ...
reverse-string
reverse-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\nWrite a function that reverses a string. The input string is given as an...
reverse-vowels-of-a-string
reverse-vowels-of-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 a string s, reverse only all the vowels in the string and return i...
top-k-frequent-elements
top-k-frequent-elements__01__python
Heap
true
[ { "role": "system", "content": "You 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 the k most frequent...
intersection-of-two-arrays
intersection-of-two-arrays__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 integer arrays nums1 and nums2, return an array of their inter...
android-unlock-patterns
android-unlock-patterns__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\nAndroid devices have a special lock screen with a 3 x 3 grid of dots. Us...
line-reflection
line-reflection__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 n points on a 2D plane, find if there is such a line parallel to t...
count-numbers-with-unique-digits
count-numbers-with-unique-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\nGiven an integer n, return the count of all numbers with unique digits, ...
sort-transformed-array
sort-transformed-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 a sorted integer array nums and three integers a, b and c, apply a...
bomb-enemy
bomb-enemy__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 m x n matrix grid where each cell is either a wall 'W', an enem...
valid-perfect-square
valid-perfect-square__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 a positive integer num, return true if num is a perfect square or ...
plus-one-linked-list
plus-one-linked-list__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 non-negative integer represented as a linked list of digits, plu...
range-addition
range-addition__02__python
Array
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an integer length and an array updates where updates[i] = ...
sum-of-two-integers
sum-of-two-integers__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 a and b, return the sum of the two integers without u...
super-pow
super-pow__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\nYour task is to calculate ab mod 1337 where a is a positive integer and ...
guess-number-higher-or-lower-ii
guess-number-higher-or-lower-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\nWe are playing the Guessing Game. The game will work as follows:\n\n\tI ...
wiggle-subsequence
wiggle-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\nA wiggle sequence is a sequence where the differences between successive...
combination-sum-iv
combination-sum-iv__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 distinct integers nums and a target integer target, re...
kth-smallest-element-in-a-sorted-matrix
kth-smallest-element-in-a-sorted-matrix__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 n x n matrix where each of the rows and columns is sorted in as...
ransom-note
ransom-note__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 ransomNote and magazine, return true if ransomNote can...
lexicographical-numbers
lexicographical-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\nGiven an integer n, return all the numbers in the range [1, n] sorted in...
first-unique-character-in-a-string
first-unique-character-in-a-string__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 s, find the first non-repeating character in it and retur...
longest-absolute-file-path
longest-absolute-file-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\nSuppose we have a file system that stores both files and directories. An...
find-the-difference
find-the-difference__01__python
Bit Manipulation
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given two strings s and t.\n\nString t is generated by random sh...
find-the-difference
find-the-difference__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\nYou are given two strings s and t.\n\nString t is generated by random sh...
elimination-game
elimination-game__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 have a list arr of all integers in the range [1, n] sorted in a stri...
perfect-rectangle
perfect-rectangle__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 rectangles where rectangles[i] = [xi, yi, ai, bi] represe...
is-subsequence
is-subsequence__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 s is a subsequence of t, or fa...
utf-8-validation
utf-8-validation__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 data representing the data, return whether it is ...
decode-string
decode-string__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 encoded string, return its decoded string.\n\nThe encoding rule...
longest-substring-with-at-least-k-repeating-characters
longest-substring-with-at-least-k-repeating-characters__01__python
Sliding Window
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a string s and an integer k, return the length of the longest subs...
rotate-function
rotate-function__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 of length n.\n\nAssume arrk to be an...
evaluate-division
evaluate-division__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 array of variable pairs equations and an array of real ...
nth-digit
nth-digit__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 nth digit of the infinite integer sequenc...
binary-watch
binary-watch__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\nA binary watch has 4 LEDs on the top to represent the hours (0-11), and ...
binary-watch
binary-watch__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\nA binary watch has 4 LEDs on the top to represent the hours (0-11), and ...
remove-k-digits
remove-k-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\nGiven string num representing a non-negative integer num, and an integer...
frog-jump
frog-jump__01__python
Memoization
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nA frog is crossing a river. The river is divided into some number of uni...
frog-jump
frog-jump__02__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nA frog is crossing a river. The river is divided into some number of uni...
sum-of-left-leaves
sum-of-left-leaves__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 sum of all left leaves.\n\nA...
sum-of-left-leaves
sum-of-left-leaves__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 sum of all left leaves.\n\nA...
convert-a-number-to-hexadecimal
convert-a-number-to-hexadecimal__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 32-bit integer num, return a string representing its hexadecimal...
queue-reconstruction-by-height
queue-reconstruction-by-height__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 people, people, which are the attributes of so...
valid-word-abbreviation
valid-word-abbreviation__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 string can be abbreviated by replacing any number of non-adjacent, non...
longest-palindrome
longest-palindrome__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a string s which consists of lowercase or uppercase letters, retur...
longest-palindrome
longest-palindrome__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 string s which consists of lowercase or uppercase letters, retur...
fizz-buzz
fizz-buzz__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 a string array answer (1-indexed) where:\n\n\...
third-maximum-number
third-maximum-number__01__python
Sorting
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums, return the third distinct maximum number in...
add-strings
add-strings__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 non-negative integers, num1 and num2 represented as string, re...
partition-equal-subset-sum
partition-equal-subset-sum__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums, return true if you can partition the array ...
partition-equal-subset-sum
partition-equal-subset-sum__02__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums, return true if you can partition the array ...
sentence-screen-fitting
sentence-screen-fitting__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 rows x cols screen and a sentence represented as a list of strin...
battleships-in-a-board
battleships-in-a-board__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 m x n matrix board where each cell is a battleship 'X' or empty...
strong-password-checker
strong-password-checker__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\nA password is considered strong if the below conditions are all met:\n\n...
maximum-xor-of-two-numbers-in-an-array
maximum-xor-of-two-numbers-in-an-array__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, return the maximum result of nums[i] XOR nu...
valid-word-square
valid-word-square__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 strings words, return true if it forms a valid word sq...
reconstruct-original-digits-from-english
reconstruct-original-digits-from-english__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a string s containing an out-of-order English representation of di...
longest-repeating-character-replacement
longest-repeating-character-replacement__01__python
Two Pointers
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a string s and an integer k. You can choose any character ...
minimum-genetic-mutation
minimum-genetic-mutation__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 gene string can be represented by an 8-character long string, with cho...
non-overlapping-intervals
non-overlapping-intervals__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an array of intervals intervals where intervals[i] = [starti, endi...
path-sum-iii
path-sum-iii__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 the root of a binary tree and an integer targetSum, return the num...
find-all-anagrams-in-a-string
find-all-anagrams-in-a-string__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 two strings s and p, return an array of all the start indices of p...
find-all-anagrams-in-a-string
find-all-anagrams-in-a-string__02__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 two strings s and p, return an array of all the start indices of p...
ternary-expression-parser
ternary-expression-parser__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 string expression representing arbitrarily nested ternary expres...
k-th-smallest-in-lexicographical-order
k-th-smallest-in-lexicographical-order__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven two integers n and k, return the kth lexicographically smallest in...
arranging-coins
arranging-coins__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 have n coins and you want to build a staircase with these coins. The...
arranging-coins
arranging-coins__02__python
Binary Search
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou have n coins and you want to build a staircase with these coins. The...
string-compression
string-compression__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 characters chars, compress it using the following algo...
add-two-numbers-ii
add-two-numbers-ii__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given two non-empty linked lists representing two non-negative i...
arithmetic-slices-ii-subsequence
arithmetic-slices-ii-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 all the arithmetic sub...
find-all-numbers-disappeared-in-an-array
find-all-numbers-disappeared-in-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 an array nums of n integers where nums[i] is in the range [1, n], ...
find-all-numbers-disappeared-in-an-array
find-all-numbers-disappeared-in-an-array__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 array nums of n integers where nums[i] is in the range [1, n], ...
minimum-number-of-arrows-to-burst-balloons
minimum-number-of-arrows-to-burst-balloons__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 some spherical balloons taped onto a flat wall that represents...
minimum-moves-to-equal-array-elements
minimum-moves-to-equal-array-elements__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums of size n, return the minimum number of move...
4sum-ii
4sum-ii__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 four integer arrays nums1, nums2, nums3, and nums4 all of length n...
assign-cookies
assign-cookies__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\nAssume you are an awesome parent and want to give your children some coo...
132-pattern
132-pattern__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 n integers nums, a 132 pattern is a subsequence of thr...
circular-array-loop
circular-array-loop__01__python
Two Pointers
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are playing a game involving a circular array of non-zero integers n...
poor-pigs
poor-pigs__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 buckets buckets of liquid, where exactly one of the buckets is...
repeated-substring-pattern
repeated-substring-pattern__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, check if it can be constructed by taking a substring o...
hamming-distance
hamming-distance__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\nThe Hamming distance between two integers is the number of positions at ...
minimum-moves-to-equal-array-elements-ii
minimum-moves-to-equal-array-elements-ii__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 of size n, return the minimum number of move...
island-perimeter
island-perimeter__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 row x col grid representing a map where grid[i][j] = 1 rep...
can-i-win
can-i-win__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\nIn the \"100 game\" two players take turns adding, to a running total, a...
optimal-account-balancing
optimal-account-balancing__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an array of transactions transactions where transactions[i...
count-the-repetitions
count-the-repetitions__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nWe define str = [s, n] as the string str which consists of the string s ...
unique-substrings-in-wraparound-string
unique-substrings-in-wraparound-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\nWe define the string base to be the infinite wraparound string of \"abcd...
validate-ip-address
validate-ip-address__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 queryIP, return \"IPv4\" if IP is a valid IPv4 address, \...
convex-polygon
convex-polygon__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 points on the X-Y plane points where points[i]...
encode-string-with-shortest-length
encode-string-with-shortest-length__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, encode the string such that its encoded length is the ...
matchsticks-to-square
matchsticks-to-square__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array matchsticks where matchsticks[i] is the l...
matchsticks-to-square
matchsticks-to-square__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 matchsticks where matchsticks[i] is the l...
heaters
heaters__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\nWinter is coming! During the contest, your first job is to design a stan...
number-complement
number-complement__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\nThe complement of an integer is the integer you get when you flip all th...
total-hamming-distance
total-hamming-distance__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\nThe Hamming distance between two integers is the number of positions at ...
magical-string
magical-string__01__python
Two Pointers
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nA magical string s consists of only '1' and '2' and obeys the following ...
license-key-formatting
license-key-formatting__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 license key represented as a string s that consists of o...
smallest-good-base
smallest-good-base__01__python
Binary Search
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an integer n represented as a string, return the smallest good bas...