slug
stringlengths
3
79
solution_id
stringlengths
13
89
primary_algorithm
stringclasses
22 values
verified
null
messages
listlengths
3
3
maximum-sum-of-almost-unique-subarray
maximum-sum-of-almost-unique-subarray__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 two positive integers m and k.\n\n...
count-k-subsequences-of-a-string-with-maximum-beauty
count-k-subsequences-of-a-string-with-maximum-beauty__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 an integer k.\n\nA k-subsequence is a subsequ...
count-symmetric-integers
count-symmetric-integers__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 two positive integers low and high.\n\nAn integer x consisti...
minimum-operations-to-make-a-special-number
minimum-operations-to-make-a-special-number__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 0-indexed string num representing a non-negative integer.\...
count-of-interesting-subarrays
count-of-interesting-subarrays__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 integer array nums, an integer modulo, and an in...
minimum-edge-weight-equilibrium-queries-in-a-tree
minimum-edge-weight-equilibrium-queries-in-a-tree__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\nThere is an undirected tree with n nodes labeled from 0 to n - 1. You are ...
smallest-number-with-given-digit-product
smallest-number-with-given-digit-product__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 positive integer n, return a string representing the smallest posi...
points-that-intersect-with-cars
points-that-intersect-with-cars__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 2D integer array nums representing the coordinat...
points-that-intersect-with-cars
points-that-intersect-with-cars__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 a 0-indexed 2D integer array nums representing the coordinat...
determine-if-a-cell-is-reachable-at-a-given-time
determine-if-a-cell-is-reachable-at-a-given-time__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 four integers sx, sy, fx, fy, and a non-negative integer t.\...
minimum-moves-to-spread-stones-over-grid
minimum-moves-to-spread-stones-over-grid__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 a 0-indexed 2D integer matrix grid of size 3 * 3, representi...
minimum-moves-to-spread-stones-over-grid
minimum-moves-to-spread-stones-over-grid__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 0-indexed 2D integer matrix grid of size 3 * 3, representi...
string-transformation
string-transformation__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 two strings s and t of equal length n. You can perform the f...
sum-of-remoteness-of-all-cells
sum-of-remoteness-of-all-cells__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 a 0-indexed matrix grid of order n * n. Each cell in this ma...
minimum-right-shifts-to-sort-the-array
minimum-right-shifts-to-sort-the-array__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 a 0-indexed array nums of length n containing distinct posit...
minimum-array-length-after-pair-removals
minimum-array-length-after-pair-removals__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 an integer array num sorted in non-decreasing order.\n\nYou can perf...
count-pairs-of-points-with-distance-k
count-pairs-of-points-with-distance-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 a 2D integer array coordinates and an integer k, where coord...
minimum-edge-reversals-so-every-node-is-reachable
minimum-edge-reversals-so-every-node-is-reachable__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\nThere is a simple directed graph with n nodes labeled from 0 to n - 1. The...
sum-of-values-at-indices-with-k-set-bits
sum-of-values-at-indices-with-k-set-bits__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 integer array nums and an integer k.\n\nReturn a...
happy-students
happy-students__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 length n where n is the to...
maximum-number-of-alloys
maximum-number-of-alloys__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 the owner of a company that creates alloys using various types of ...
maximum-element-sum-of-a-complete-subset-of-indices
maximum-element-sum-of-a-complete-subset-of-indices__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 1-indexed array nums. Your task is to select a complete su...
maximum-length-of-semi-decreasing-subarrays
maximum-length-of-semi-decreasing-subarrays__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.\n\nReturn the length of the longest s...
maximum-odd-binary-number
maximum-odd-binary-number__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 binary string s that contains at least one '1'.\n\nYou hav...
beautiful-towers-i
beautiful-towers-i__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 array heights of n integers representing the number of br...
beautiful-towers-i
beautiful-towers-i__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 array heights of n integers representing the number of br...
beautiful-towers-ii
beautiful-towers-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 a 0-indexed array maxHeights of n integers.\n\nYou are taske...
count-valid-paths-in-a-tree
count-valid-paths-in-a-tree__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\nThere is an undirected tree with n nodes labeled from 1 to n. You are give...
count-valid-paths-in-a-tree
count-valid-paths-in-a-tree__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\nThere is an undirected tree with n nodes labeled from 1 to n. You are give...
the-wording-game
the-wording-game__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 each have a lexicographically sorted array of strings named ...
minimum-operations-to-collect-elements
minimum-operations-to-collect-elements__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 array nums of positive integers and an integer k.\n\nIn o...
minimum-number-of-operations-to-make-array-empty
minimum-number-of-operations-to-make-array-empty__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 array nums consisting of positive integers.\n\nT...
split-array-into-maximum-number-of-subarrays
split-array-into-maximum-number-of-subarrays__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 non-negative integers.\n\nWe def...
maximum-number-of-k-divisible-components
maximum-number-of-k-divisible-components__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 ...
maximum-value-of-an-ordered-triplet-i
maximum-value-of-an-ordered-triplet-i__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 a 0-indexed integer array nums.\n\nReturn the maximum value ...
maximum-value-of-an-ordered-triplet-ii
maximum-value-of-an-ordered-triplet-ii__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 a 0-indexed integer array nums.\n\nReturn the maximum value ...
minimum-size-subarray-in-infinite-array
minimum-size-subarray-in-infinite-array__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 and an integer target.\n\nA 0-indexed...
count-visited-nodes-in-a-directed-graph
count-visited-nodes-in-a-directed-graph__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\nThere is a directed graph consisting of n nodes numbered from 0 to n - 1 a...
minimizing-array-after-replacing-pairs-with-their-product
minimizing-array-after-replacing-pairs-with-their-product__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 an integer array nums and an integer k, you can perform the followin...
divisible-and-non-divisible-sums-difference
divisible-and-non-divisible-sums-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 positive integers n and m.\n\nDefine two integers as follows...
minimum-processing-time
minimum-processing-time__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 have a certain number of processors, each having 4 cores. The number o...
apply-operations-to-make-two-strings-equal
apply-operations-to-make-two-strings-equal__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 0-indexed binary strings s1 and s2, both of length n, an...
apply-operations-to-make-two-strings-equal
apply-operations-to-make-two-strings-equal__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 two 0-indexed binary strings s1 and s2, both of length n, an...
apply-operations-on-array-to-maximize-sum-of-squares
apply-operations-on-array-to-maximize-sum-of-squares__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 nums and a positive integer k.\n\n...
maximum-linear-stock-score
maximum-linear-stock-score__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 a 1-indexed integer array prices, where prices[i] is the price of a ...
last-visited-integers
last-visited-integers__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 where nums[i] is either a positive integer or ...
longest-unequal-adjacent-groups-subsequence-i
longest-unequal-adjacent-groups-subsequence-i__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 array words and a binary array groups both of lengt...
longest-unequal-adjacent-groups-subsequence-ii
longest-unequal-adjacent-groups-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 a string array words, and an array groups, both arrays havin...
count-of-sub-multisets-with-bounded-sum
count-of-sub-multisets-with-bounded-sum__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 array nums of non-negative integers, and two int...
find-indices-with-index-and-value-difference-i
find-indices-with-index-and-value-difference-i__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 a 0-indexed integer array nums having length n, an integer i...
shortest-and-lexicographically-smallest-beautiful-string
shortest-and-lexicographically-smallest-beautiful-string__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 binary string s and a positive integer k.\n\nA substring o...
shortest-and-lexicographically-smallest-beautiful-string
shortest-and-lexicographically-smallest-beautiful-string__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 binary string s and a positive integer k.\n\nA substring o...
find-indices-with-index-and-value-difference-ii
find-indices-with-index-and-value-difference-ii__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 a 0-indexed integer array nums having length n, an integer i...
construct-product-matrix
construct-product-matrix__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\nGiven a 0-indexed 2D integer matrix grid of size n * m, we define a 0-inde...
maximum-profitable-triplets-with-increasing-prices-i
maximum-profitable-triplets-with-increasing-prices-i__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 the 0-indexed arrays prices and profits of length n. There are n ite...
maximum-profitable-triplets-with-increasing-prices-i
maximum-profitable-triplets-with-increasing-prices-i__02__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\nGiven the 0-indexed arrays prices and profits of length n. There are n ite...
maximum-profitable-triplets-with-increasing-prices-i
maximum-profitable-triplets-with-increasing-prices-i__03__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\nGiven the 0-indexed arrays prices and profits of length n. There are n ite...
minimum-sum-of-mountain-triplets-i
minimum-sum-of-mountain-triplets-i__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 a 0-indexed array nums of integers.\n\nA triplet of indices ...
minimum-sum-of-mountain-triplets-ii
minimum-sum-of-mountain-triplets-ii__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 a 0-indexed array nums of integers.\n\nA triplet of indices ...
minimum-number-of-groups-to-create-a-valid-assignment
minimum-number-of-groups-to-create-a-valid-assignment__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 collection of numbered balls and instructed to sort them i...
minimum-changes-to-make-k-semi-palindromes
minimum-changes-to-make-k-semi-palindromes__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 s and an integer k, partition s into k substrings such that...
minimum-changes-to-make-k-semi-palindromes
minimum-changes-to-make-k-semi-palindromes__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\nGiven a string s and an integer k, partition s into k substrings such that...
number-of-ways-to-reach-destination-in-the-grid
number-of-ways-to-reach-destination-in-the-grid__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 two integers n and m which represent the size of a 1-indexed...
subarrays-distinct-element-sum-of-squares-i
subarrays-distinct-element-sum-of-squares-i__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 integer array nums.\n\nThe distinct count of a s...
minimum-number-of-changes-to-make-binary-string-beautiful
minimum-number-of-changes-to-make-binary-string-beautiful__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 0-indexed binary string s having an even length.\n\nA stri...
length-of-the-longest-subsequence-that-sums-to-target
length-of-the-longest-subsequence-that-sums-to-target__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 array of integers nums, and an integer target.\n...
length-of-the-longest-subsequence-that-sums-to-target
length-of-the-longest-subsequence-that-sums-to-target__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 0-indexed array of integers nums, and an integer target.\n...
subarrays-distinct-element-sum-of-squares-ii
subarrays-distinct-element-sum-of-squares-ii__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 integer array nums.\n\nThe distinct count of a s...
find-the-k-or-of-an-array
find-the-k-or-of-an-array__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, and an integer k. Let's introduce K-o...
minimum-equal-sum-of-two-arrays-after-replacing-zeros
minimum-equal-sum-of-two-arrays-after-replacing-zeros__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 arrays nums1 and nums2 consisting of positive integers.\...
minimum-increment-operations-to-make-array-beautiful
minimum-increment-operations-to-make-array-beautiful__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 integer array nums having length n, and an integ...
maximum-points-after-collecting-coins-from-all-nodes
maximum-points-after-collecting-coins-from-all-nodes__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 exists an undirected tree rooted at node 0 with n nodes labeled from...
maximum-profitable-triplets-with-increasing-prices-ii
maximum-profitable-triplets-with-increasing-prices-ii__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\nGiven the 0-indexed arrays prices and profits of length n. There are n ite...
find-champion-i
find-champion-i__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 teams numbered from 0 to n - 1 in a tournament.\n\nGiven a 0-i...
find-champion-ii
find-champion-ii__01__java
Graph
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 teams numbered from 0 to n - 1 in a tournament; each team is a...
maximum-score-after-applying-operations-on-a-tree
maximum-score-after-applying-operations-on-a-tree__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\nThere is an undirected tree with n nodes labeled from 0 to n - 1, and root...
maximum-balanced-subsequence-sum
maximum-balanced-subsequence-sum__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 integer array nums.\n\nA subsequence of nums hav...
distribute-candies-among-children-iii
distribute-candies-among-children-iii__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 two positive integers n and limit.\n\nReturn the total numbe...
distribute-candies-among-children-i
distribute-candies-among-children-i__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 two positive integers n and limit.\n\nReturn the total numbe...
distribute-candies-among-children-ii
distribute-candies-among-children-ii__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 two positive integers n and limit.\n\nReturn the total numbe...
number-of-strings-which-can-be-rearranged-to-contain-substring
number-of-strings-which-can-be-rearranged-to-contain-substring__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 n.\n\nA string s is called good if it contains on...
number-of-strings-which-can-be-rearranged-to-contain-substring
number-of-strings-which-can-be-rearranged-to-contain-substring__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 n.\n\nA string s is called good if it contains on...
maximum-spending-after-buying-items
maximum-spending-after-buying-items__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 m * n integer matrix values, representing the va...
maximum-strong-pair-xor-i
maximum-strong-pair-xor-i__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 integer array nums. A pair of integers x and y i...
maximum-strong-pair-xor-i
maximum-strong-pair-xor-i__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 a 0-indexed integer array nums. A pair of integers x and y i...
high-access-employees
high-access-employees__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 2D 0-indexed array of strings, access_times, with size n. ...
minimum-operations-to-maximize-last-elements-in-arrays
minimum-operations-to-maximize-last-elements-in-arrays__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 0-indexed integer arrays, nums1 and nums2, both having l...
maximum-strong-pair-xor-ii
maximum-strong-pair-xor-ii__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. A pair of integers x and y i...
number-of-equal-numbers-blocks
number-of-equal-numbers-blocks__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 of integers, nums. The following property ...
number-of-equal-numbers-blocks
number-of-equal-numbers-blocks__02__java
Divide and Conquer
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 integers, nums. The following property ...
make-three-strings-equal
make-three-strings-equal__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 three strings: s1, s2, and s3. In one operation you can choo...
separate-black-and-white-balls
separate-black-and-white-balls__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 are n balls on a table, each ball has a color black or white.\n\nYou...
maximum-xor-product
maximum-xor-product__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 three integers a, b, and n, return the maximum value of (a XOR x) * ...
find-building-where-alice-and-bob-can-meet
find-building-where-alice-and-bob-can-meet__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 heights of positive integers, where height...
maximum-gcd-sum-of-a-subarray
maximum-gcd-sum-of-a-subarray__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 an array of integers nums and an integer k.\n\nThe gcd-sum o...
find-words-containing-character
find-words-containing-character__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 a 0-indexed array of strings words and a character x.\n\nRet...
maximize-area-of-square-hole-in-grid
maximize-area-of-square-hole-in-grid__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 the two integers, n and m and two integer arrays, hBars and ...
minimum-number-of-coins-for-fruits
minimum-number-of-coins-for-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 an 0-indexed integer array prices where prices[i] denotes th...
minimum-number-of-coins-for-fruits
minimum-number-of-coins-for-fruits__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 0-indexed integer array prices where prices[i] denotes th...
minimum-number-of-coins-for-fruits
minimum-number-of-coins-for-fruits__03__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 0-indexed integer array prices where prices[i] denotes th...