slug
stringlengths
3
79
solution_id
stringlengths
13
89
primary_algorithm
stringclasses
22 values
verified
null
messages
listlengths
3
3
meeting-rooms-iii
meeting-rooms-iii__01__java
Heap
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer n. There are n rooms numbered from 0 to n - 1.\n\...
minimum-time-to-kill-all-monsters
minimum-time-to-kill-all-monsters__01__java
Memoization
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array power where power[i] is the power of the it...
minimum-time-to-kill-all-monsters
minimum-time-to-kill-all-monsters__02__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array power where power[i] is the power of the it...
most-frequent-even-element
most-frequent-even-element__01__java
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums, return the most frequent even element.\n\nIf ...
optimal-partition-of-string
optimal-partition-of-string__01__java
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven a string s, partition the string into one or more substrings such th...
divide-intervals-into-minimum-number-of-groups
divide-intervals-into-minimum-number-of-groups__01__java
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 2D integer array intervals where intervals[i] = [lefti, ri...
longest-increasing-subsequence-ii
longest-increasing-subsequence-ii__01__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums and an integer k.\n\nFind the longest ...
design-sql
design-sql__01__java
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given two string arrays, names and columns, both of size n. The it...
count-days-spent-together
count-days-spent-together__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nAlice and Bob are traveling to Rome for separate business meetings.\n\nYou...
maximum-matching-of-players-with-trainers
maximum-matching-of-players-with-trainers__01__java
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array players, where players[i] represen...
smallest-subarrays-with-maximum-bitwise-or
smallest-subarrays-with-maximum-bitwise-or__01__java
Sliding Window
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed array nums of length n, consisting of non-negati...
minimum-money-required-before-transactions
minimum-money-required-before-transactions__01__java
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed 2D integer array transactions, where transaction...
smallest-even-multiple
smallest-even-multiple__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven a positive integer n, return the smallest positive integer that is a...
length-of-the-longest-alphabetical-continuous-substring
length-of-the-longest-alphabetical-continuous-substring__01__java
String
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nAn alphabetical continuous string is a string consisting of consecutive le...
reverse-odd-levels-of-binary-tree
reverse-odd-levels-of-binary-tree__01__java
BFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven the root of a perfect binary tree, reverse the node values at each o...
sum-of-prefix-scores-of-strings
sum-of-prefix-scores-of-strings__01__java
Trie
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an array words of size n consisting of non-empty strings.\n\...
closest-fair-integer
closest-fair-integer__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a positive integer n.\n\nWe call an integer k fair if the nu...
sort-the-people
sort-the-people__01__java
Sorting
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an array of strings names, and an array heights that consist...
sort-the-people
sort-the-people__02__java
Sorting
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an array of strings names, and an array heights that consist...
longest-subarray-with-maximum-bitwise-and
longest-subarray-with-maximum-bitwise-and__01__java
Bit Manipulation
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums of size n.\n\nConsider a non-empty sub...
find-all-good-indices
find-all-good-indices__01__java
Recursion
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array nums of size n and a positive inte...
number-of-good-paths
number-of-good-paths__01__java
Sorting
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nThere is a tree (i.e. a connected, undirected graph with no cycles) consis...
merge-operations-to-turn-array-into-a-palindrome
merge-operations-to-turn-array-into-a-palindrome__01__java
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an array nums consisting of positive integers.\n\nYou can pe...
remove-letter-to-equalize-frequency
remove-letter-to-equalize-frequency__01__java
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed string word, consisting of lowercase English let...
longest-uploaded-prefix
longest-uploaded-prefix__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a stream of n videos, each represented by a distinct number ...
bitwise-xor-of-all-pairings
bitwise-xor-of-all-pairings__01__java
Bit Manipulation
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given two 0-indexed arrays, nums1 and nums2, consisting of non-neg...
number-of-pairs-satisfying-inequality
number-of-pairs-satisfying-inequality__01__java
Binary Search
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given two 0-indexed integer arrays nums1 and nums2, each of size n...
number-of-common-factors
number-of-common-factors__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven two positive integers a and b, return the number of common factors o...
number-of-common-factors
number-of-common-factors__02__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven two positive integers a and b, return the number of common factors o...
maximum-sum-of-an-hourglass
maximum-sum-of-an-hourglass__01__java
Array
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an m x n integer matrix grid.\n\nWe define an hourglass as a...
minimize-xor
minimize-xor__01__java
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven two positive integers num1 and num2, find the positive integer x suc...
maximum-deletions-on-a-string
maximum-deletions-on-a-string__01__java
Memoization
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a string s consisting of only lowercase English letters. In ...
maximum-deletions-on-a-string
maximum-deletions-on-a-string__02__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a string s consisting of only lowercase English letters. In ...
maximize-total-tastiness-of-purchased-fruits
maximize-total-tastiness-of-purchased-fruits__01__java
Memoization
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given two non-negative integer arrays price and tastiness, both ar...
the-employee-that-worked-on-the-longest-task
the-employee-that-worked-on-the-longest-task__01__java
Array
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nThere are n employees, each with a unique id from 0 to n - 1.\n\nYou are g...
find-the-original-array-of-prefix-xor
find-the-original-array-of-prefix-xor__01__java
Bit Manipulation
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array pref of size n. Find and return the array a...
using-a-robot-to-print-the-lexicographically-smallest-string
using-a-robot-to-print-the-lexicographically-smallest-string__01__java
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a string s and a robot that currently holds an empty string ...
paths-in-matrix-whose-sum-is-divisible-by-k
paths-in-matrix-whose-sum-is-divisible-by-k__01__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed m x n integer matrix grid and an integer k. You ...
minimum-split-into-subarrays-with-gcd-greater-than-one
minimum-split-into-subarrays-with-gcd-greater-than-one__01__java
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an array nums consisting of positive integers.\n\nSplit the ...
number-of-valid-clock-times
number-of-valid-clock-times__01__java
String
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a string of length 5 called time, representing the current t...
number-of-valid-clock-times
number-of-valid-clock-times__02__java
String
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a string of length 5 called time, representing the current t...
range-product-queries-of-powers
range-product-queries-of-powers__01__java
Bit Manipulation
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven a positive integer n, there exists a 0-indexed array called powers, ...
minimize-maximum-of-array
minimize-maximum-of-array__01__java
Binary Search
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed array nums comprising of n non-negative integers...
create-components-with-same-value
create-components-with-same-value__01__java
DFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nThere is an undirected tree with n nodes labeled from 0 to n - 1.\n\nYou a...
largest-positive-integer-that-exists-with-its-negative
largest-positive-integer-that-exists-with-its-negative__01__java
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums that does not contain any zeros, find the larg...
count-number-of-distinct-integers-after-reverse-operations
count-number-of-distinct-integers-after-reverse-operations__01__java
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an array nums consisting of positive integers.\n\nYou have t...
sum-of-number-and-its-reverse
sum-of-number-and-its-reverse__01__java
Brute Force
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven a non-negative integer num, return true if num can be expressed as t...
count-subarrays-with-fixed-bounds
count-subarrays-with-fixed-bounds__01__java
Brute Force
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums and two integers minK and maxK.\n\nA f...
number-of-nodes-with-value-one
number-of-nodes-with-value-one__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nThere is an undirected connected tree with n nodes labeled from 1 to n and...
determine-if-two-events-have-conflict
determine-if-two-events-have-conflict__01__java
Array
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given two arrays of strings that represent two inclusive events th...
number-of-subarrays-with-gcd-equal-to-k
number-of-subarrays-with-gcd-equal-to-k__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums and an integer k, return the number of subarra...
minimum-cost-to-make-array-equal
minimum-cost-to-make-array-equal__01__java
Sorting
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given two 0-indexed arrays nums and cost consisting each of n posi...
minimum-cost-to-make-array-equal
minimum-cost-to-make-array-equal__02__java
Sorting
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given two 0-indexed arrays nums and cost consisting each of n posi...
minimum-number-of-operations-to-make-arrays-similar
minimum-number-of-operations-to-make-arrays-similar__01__java
Sorting
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given two positive integer arrays nums and target, of the same len...
number-of-distinct-binary-strings-after-applying-operations
number-of-distinct-binary-strings-after-applying-operations__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a binary string s and a positive integer k.\n\nYou can apply...
odd-string-difference
odd-string-difference__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an array of equal-length strings words. Assume that the leng...
words-within-two-edits-of-dictionary
words-within-two-edits-of-dictionary__01__java
Brute Force
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given two string arrays, queries and dictionary. All words in each...
destroy-sequential-targets
destroy-sequential-targets__01__java
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed array nums consisting of positive integers, repr...
next-greater-element-iv
next-greater-element-iv__01__java
Sorting
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed array of non-negative integers nums. For each in...
average-value-of-even-numbers-that-are-divisible-by-three
average-value-of-even-numbers-that-are-divisible-by-three__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums of positive integers, return the average value...
most-popular-video-creator
most-popular-video-creator__01__java
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given two string arrays creators and ids, and an integer array vie...
minimum-addition-to-make-integer-beautiful
minimum-addition-to-make-integer-beautiful__01__java
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given two positive integers n and target.\n\nAn integer is conside...
height-of-binary-tree-after-subtree-removal-queries
height-of-binary-tree-after-subtree-removal-queries__01__java
DFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given the root of a binary tree with n nodes. Each node is assigne...
sort-array-by-moving-items-to-empty-space
sort-array-by-moving-items-to-empty-space__01__java
Sorting
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums of size n containing each element from...
apply-operations-to-an-array
apply-operations-to-an-array__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed array nums of size n consisting of non-negative ...
maximum-sum-of-distinct-subarrays-with-length-k
maximum-sum-of-distinct-subarrays-with-length-k__01__java
Sliding Window
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums and an integer k. Find the maximum sub...
total-cost-to-hire-k-workers
total-cost-to-hire-k-workers__01__java
Heap
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array costs where costs[i] is the cost o...
minimum-total-distance-traveled
minimum-total-distance-traveled__01__java
Memoization
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nThere are some robots and factories on the X-axis. You are given an intege...
minimum-subarrays-in-a-valid-split
minimum-subarrays-in-a-valid-split__01__java
Memoization
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums.\n\nSplitting of an integer array nums...
number-of-distinct-averages
number-of-distinct-averages__01__java
Sorting
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array nums of even length.\n\nAs long as...
number-of-distinct-averages
number-of-distinct-averages__02__java
Two Pointers
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array nums of even length.\n\nAs long as...
count-ways-to-build-good-strings
count-ways-to-build-good-strings__01__java
Memoization
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven the integers zero, one, low, and high, we can construct a string by ...
most-profitable-path-in-a-tree
most-profitable-path-in-a-tree__01__java
DFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nThere is an undirected tree with n nodes labeled from 0 to n - 1, rooted a...
split-message-based-on-limit
split-message-based-on-limit__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a string, message, and a positive integer, limit.\n\nYou mus...
convert-the-temperature
convert-the-temperature__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a non-negative floating point number rounded to two decimal ...
number-of-subarrays-with-lcm-equal-to-k
number-of-subarrays-with-lcm-equal-to-k__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums and an integer k, return the number of subarra...
minimum-number-of-operations-to-sort-a-binary-tree-by-level
minimum-number-of-operations-to-sort-a-binary-tree-by-level__01__java
BFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given the root of a binary tree with unique values.\n\nIn one oper...
maximum-number-of-non-overlapping-palindrome-substrings
maximum-number-of-non-overlapping-palindrome-substrings__01__java
Memoization
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a string s and a positive integer k.\n\nSelect a set of non-...
minimum-cost-to-buy-apples
minimum-cost-to-buy-apples__01__java
Heap
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a positive integer n representing n cities numbered from 1 t...
number-of-unequal-triplets-in-array
number-of-unequal-triplets-in-array__01__java
Brute Force
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed array of positive integers nums. Find the number...
number-of-unequal-triplets-in-array
number-of-unequal-triplets-in-array__02__java
Binary Search
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed array of positive integers nums. Find the number...
number-of-unequal-triplets-in-array
number-of-unequal-triplets-in-array__03__java
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed array of positive integers nums. Find the number...
closest-nodes-queries-in-a-binary-search-tree
closest-nodes-queries-in-a-binary-search-tree__01__java
Binary Search
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given the root of a binary search tree and an array queries of siz...
minimum-fuel-cost-to-report-to-the-capital
minimum-fuel-cost-to-report-to-the-capital__01__java
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nThere is a tree (i.e., a connected, undirected graph with no cycles) struc...
number-of-beautiful-partitions
number-of-beautiful-partitions__01__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a string s that consists of the digits '1' to '9' and two in...
maximum-xor-of-two-non-overlapping-subtrees
maximum-xor-of-two-non-overlapping-subtrees__01__java
DFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nThere is an undirected tree with n nodes labeled from 0 to n - 1. You are ...
minimum-cuts-to-divide-a-circle
minimum-cuts-to-divide-a-circle__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nA valid cut in a circle can be:\n\n\tA cut that is represented by a straig...
difference-between-ones-and-zeros-in-row-and-column
difference-between-ones-and-zeros-in-row-and-column__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed m x n binary matrix grid.\n\nA 0-indexed m x n d...
minimum-penalty-for-a-shop
minimum-penalty-for-a-shop__01__java
String
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given the customer visit log of a shop represented by a 0-indexed ...
count-palindromic-subsequences
count-palindromic-subsequences__01__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven a string of digits s, return the number of palindromic subsequences ...
find-the-pivot-integer
find-the-pivot-integer__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven a positive integer n, find the pivot integer x such that:\n\n\tThe s...
find-the-pivot-integer
find-the-pivot-integer__02__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven a positive integer n, find the pivot integer x such that:\n\n\tThe s...
append-characters-to-string-to-make-subsequence
append-characters-to-string-to-make-subsequence__01__java
Two Pointers
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given two strings s and t consisting of only lowercase English let...
remove-nodes-from-linked-list
remove-nodes-from-linked-list__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given the head of a linked list.\n\nRemove every node which has a ...
remove-nodes-from-linked-list
remove-nodes-from-linked-list__02__java
Linked List
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given the head of a linked list.\n\nRemove every node which has a ...
count-subarrays-with-median-k
count-subarrays-with-median-k__01__java
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an array nums of size n consisting of distinct integers from...
number-of-substrings-with-fixed-ratio
number-of-substrings-with-fixed-ratio__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a binary string s, and two integers num1 and num2. num1 and ...
circular-sentence
circular-sentence__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nA sentence is a list of words that are separated by a single space with no...
circular-sentence
circular-sentence__02__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nA sentence is a list of words that are separated by a single space with no...
divide-players-into-teams-of-equal-skill
divide-players-into-teams-of-equal-skill__01__java
Sorting
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a positive integer array skill of even length n where skill[...