slug
stringlengths
3
79
solution_id
stringlengths
13
89
primary_algorithm
stringclasses
22 values
verified
null
messages
listlengths
3
3
minimum-increments-to-equalize-leaf-paths
minimum-increments-to-equalize-leaf-paths__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 and an undirected tree rooted at node 0 with n ...
minimum-time-to-transport-all-individuals
minimum-time-to-transport-all-individuals__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\nYou are given n individuals at a base camp who need to cross a river to re...
once-twice
once-twice__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. In this array:\n\n\t\n\tExactly one e...
minimum-cost-path-with-alternating-directions-i
minimum-cost-path-with-alternating-directions-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 integers m and n representing the number of rows and col...
partition-string
partition-string__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 string s, partition it into unique segments according to the follo...
partition-string
partition-string__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 string s, partition it into unique segments according to the follo...
longest-common-prefix-between-adjacent-strings-after-removals
longest-common-prefix-between-adjacent-strings-after-removals__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 of strings words. For each index i in the range [0,...
partition-array-to-minimize-xor
partition-array-to-minimize-xor__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\nYour task is to p...
maximize-spanning-tree-stability-with-upgrades
maximize-spanning-tree-stability-with-upgrades__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 integer n, representing n nodes numbered from 0 to n - 1 ...
hexadecimal-and-hexatrigesimal-conversion
hexadecimal-and-hexatrigesimal-conversion__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 integer n.\n\nReturn the concatenation of the hexadecimal...
minimum-cost-path-with-alternating-directions-ii
minimum-cost-path-with-alternating-directions-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 two integers m and n representing the number of rows and col...
minimum-time-to-reach-destination-in-directed-graph
minimum-time-to-reach-destination-in-directed-graph__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\nYou are given an integer n and a directed graph with n nodes labeled from ...
minimum-stability-factor-of-array
minimum-stability-factor-of-array__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 integer array nums and an integer maxC.\n\nA subarray is ...
coupon-code-validator
coupon-code-validator__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 three arrays of length n that describe the properties of n c...
power-grid-maintenance
power-grid-maintenance__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 c representing c power stations, each with a uniq...
minimum-time-for-k-connected-components
minimum-time-for-k-connected-components__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 integer n and an undirected graph with n nodes labeled fr...
minimum-moves-to-reach-target-in-grid
minimum-moves-to-reach-target-in-grid__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, tx, and ty, representing two points (s...
minimum-number-of-primes-to-sum-to-target
minimum-number-of-primes-to-sum-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 two integers n and m.\n\nYou have to select a multiset of pr...
process-string-with-special-operations-i
process-string-with-special-operations-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 a string s consisting of lowercase English letters and the s...
minimize-maximum-component-cost
minimize-maximum-component-cost__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 undirected connected graph with n nodes labeled from 0 to...
process-string-with-special-operations-ii
process-string-with-special-operations-ii__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 s consisting of lowercase English letters and the s...
longest-palindromic-path-in-graph
longest-palindromic-path-in-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\nYou are given an integer n and an undirected graph with n nodes labeled fr...
number-of-student-replacements
number-of-student-replacements__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 integer array ranks where ranks[i] represents the rank of...
split-array-by-prime-indices
split-array-by-prime-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 an integer array nums.\n\nSplit nums into two arrays A and B...
count-islands-with-total-value-divisible-by-k
count-islands-with-total-value-divisible-by-k__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 an m x n matrix grid and a positive integer k. An island is ...
network-recovery-pathways
network-recovery-pathways__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 directed acyclic graph of n nodes numbered from 0 to n &mi...
number-of-integers-with-popcount-depth-equal-to-k-i
number-of-integers-with-popcount-depth-equal-to-k-i__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 k.\n\nFor any positive integer x, define ...
check-divisibility-by-digit-sum-and-product
check-divisibility-by-digit-sum-and-product__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. Determine whether n is divisible by th...
count-number-of-trapezoids-i
count-number-of-trapezoids-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 a 2D integer array points, where points[i] = [xi, yi] repres...
number-of-integers-with-popcount-depth-equal-to-k-ii
number-of-integers-with-popcount-depth-equal-to-k-ii__01__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 an integer array nums.\n\nFor any positive integer x, define...
count-number-of-trapezoids-ii
count-number-of-trapezoids-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 2D integer array points where points[i] = [xi, yi] represe...
maximum-median-sum-of-subsequences-of-size-3
maximum-median-sum-of-subsequences-of-size-3__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 integer array nums with a length divisible by 3.\n\nYou w...
maximum-number-of-subsequences-after-one-inserting
maximum-number-of-subsequences-after-one-inserting__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 consisting of uppercase English letters.\n\nYou a...
minimum-jumps-to-reach-end-via-prime-teleportation
minimum-jumps-to-reach-end-via-prime-teleportation__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 an integer array nums of length n.\n\nYou start at index 0, ...
partition-array-for-maximum-xor-and-and
partition-array-for-maximum-xor-and-and__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 integer array nums.\n\nPartition the array into three (po...
sort-threats-by-severity-and-exploitability
sort-threats-by-severity-and-exploitability__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 integer array threats, where each threats[i] = [IDi, se...
subarrays-with-xor-at-least-k
subarrays-with-xor-at-least-k__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 an array of positive integers nums of length n and a non‑negative in...
earliest-finish-time-for-land-and-water-rides-i
earliest-finish-time-for-land-and-water-rides-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 two categories of theme park attractions: land rides and wat...
minimum-removals-to-balance-array
minimum-removals-to-balance-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 an integer array nums and an integer k.\n\nAn array is consi...
minimum-removals-to-balance-array
minimum-removals-to-balance-array__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 an integer array nums and an integer k.\n\nAn array is consi...
earliest-finish-time-for-land-and-water-rides-ii
earliest-finish-time-for-land-and-water-rides-ii__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 categories of theme park attractions: land rides and wat...
threshold-majority-queries
threshold-majority-queries__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 integer array nums of length n and an array queries, wher...
trionic-array-i
trionic-array-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 integer array nums of length n.\n\nAn array is trionic if...
maximum-balanced-shipments
maximum-balanced-shipments__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 integer array weight of length n, representing the weight...
minimum-time-to-activate-string
minimum-time-to-activate-string__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 string s of length n and an integer array order, where ord...
trionic-array-ii
trionic-array-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 of length n.\n\nA trionic subarray is ...
longest-semi-repeating-subarray
longest-semi-repeating-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 of length n and an integer k.\n\nA sem...
flip-square-submatrix-vertically
flip-square-submatrix-vertically__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 m x n integer matrix grid, and three integers x, y, and k...
maximum-k-to-sort-a-permutation
maximum-k-to-sort-a-permutation__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 length n, where nums is a permutati...
maximum-total-from-optimal-activation-order
maximum-total-from-optimal-activation-order__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 integer arrays value and limit, both of length n.\n\nIni...
next-special-palindrome-number
next-special-palindrome-number__01__java
Backtracking
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 number is called special if:\n\n\tIt is a...
maximum-weight-in-two-bags
maximum-weight-in-two-bags__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 weights and two integers w1 and w2 represen...
minimum-sensors-to-cover-grid
minimum-sensors-to-cover-grid__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 n × m grid and an integer k.\n\nA sensor placed on cel...
number-of-perfect-pairs
number-of-perfect-pairs__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.\n\nA pair of indices (i, j) is called...
minimum-cost-path-with-edge-reversals
minimum-cost-path-with-edge-reversals__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\nYou are given a directed, weighted graph with n nodes labeled from 0 to n ...
minimum-cost-path-with-teleportations
minimum-cost-path-with-teleportations__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 m x n 2D integer array grid and an integer k. You start at...
best-time-to-buy-and-sell-stock-using-strategy
best-time-to-buy-and-sell-stock-using-strategy__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 two integer arrays prices and strategy, where:\n\n\tprices[i...
xor-after-range-multiplication-queries-i
xor-after-range-multiplication-queries-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 an integer array nums of length n and a 2D integer array que...
minimum-sum-after-divisible-sum-deletions
minimum-sum-after-divisible-sum-deletions__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\nYou may repeatedl...
xor-after-range-multiplication-queries-ii
xor-after-range-multiplication-queries-ii__01__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 an integer array nums of length n and a 2D integer array que...
determine-if-a-simple-graph-exists
determine-if-a-simple-graph-exists__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 integer array degrees, where degrees[i] represents the de...
gcd-of-odd-and-even-sums
gcd-of-odd-and-even-sums__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 integer n. Your task is to compute the GCD (greatest comm...
partition-array-into-k-distinct-groups
partition-array-into-k-distinct-groups__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 integer array nums and an integer k.\n\nYour task is to d...
jump-game-ix
jump-game-ix__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.\n\nFrom any index i, you can jump to ...
maximum-walls-destroyed-by-robots
maximum-walls-destroyed-by-robots__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 endless straight line populated with some robots and walls. Yo...
filter-characters-by-frequency
filter-characters-by-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 string s consisting of lowercase English letters and an in...
find-the-least-frequent-digit
find-the-least-frequent-digit__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 n, find the digit that occurs least frequently in its dec...
two-letter-card-game
two-letter-card-game__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 deck of cards represented by a string array cards, and eac...
twisted-mirror-path-count
twisted-mirror-path-count__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 an m x n binary grid grid where:\n\n\tgrid[i][j] == 0 represents an ...
minimum-operations-to-equalize-binary-string
minimum-operations-to-equalize-binary-string__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 binary string s, and an integer k.\n\nIn one operation, yo...
sort-array-by-absolute-value
sort-array-by-absolute-value__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\nRearrange elements of nums in non-...
restore-finishing-order
restore-finishing-order__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 order of length n and an integer array frie...
balanced-k-factor-decomposition
balanced-k-factor-decomposition__01__java
Backtracking
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 integers n and k, split the number n into exactly k positive int...
maximum-product-of-two-integers-with-no-common-bits
maximum-product-of-two-integers-with-no-common-bits__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.\n\nYour task is to find two distinct ...
sum-of-beautiful-subsequences
sum-of-beautiful-subsequences__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 integer array nums of length n.\n\nFor every positive int...
sum-of-weighted-modes-in-subarrays
sum-of-weighted-modes-in-subarrays__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.\n\nFor every subarra...
minimum-operations-to-equalize-array
minimum-operations-to-equalize-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 of length n.\n\nIn one operation, choo...
minimum-operations-to-transform-string
minimum-operations-to-transform-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 consisting only of lowercase English letters.\n\n...
count-bowl-subarrays
count-bowl-subarrays__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 integer array nums with distinct elements.\n\nA subarray ...
count-binary-palindromic-numbers
count-binary-palindromic-numbers__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 a non-negative integer n.\n\nA non-negative integer is calle...
smallest-absent-positive-greater-than-average
smallest-absent-positive-greater-than-average__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 integer array nums.\n\nReturn the smallest absent positiv...
minimum-discards-to-balance-inventory
minimum-discards-to-balance-inventory__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 two integers w and m, and an integer array arrivals, where a...
generate-schedule
generate-schedule__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 integer n representing n teams. You are asked to generate...
maximum-xor-of-subsequences
maximum-xor-of-subsequences__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 integer array nums of length n where each element is a no...
minimum-index-sum-of-common-elements
minimum-index-sum-of-common-elements__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 integer arrays nums1 and nums2 of equal length n.\n\nWe ...
earliest-time-to-finish-one-task
earliest-time-to-finish-one-task__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 2D integer array tasks where tasks[i] = [si, ti].\n\nEach ...
maximize-sum-of-at-most-k-distinct-elements
maximize-sum-of-at-most-k-distinct-elements__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 nums and an integer k.\n\nChoose at...
subsequence-sum-after-capping-elements
subsequence-sum-after-capping-elements__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 of size n and a positive integer k.\n\...
number-of-stable-subsequences
number-of-stable-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\nYou are given an integer array nums.\n\nA subsequence is stable if it does...
library-late-fee-calculator
library-late-fee-calculator__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 integer array daysLate where daysLate[i] indicates how ma...
bitwise-or-of-even-numbers-in-an-array
bitwise-or-of-even-numbers-in-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 an integer array nums.\n\nReturn the bitwise OR of all even ...
maximum-total-subarray-value-i
maximum-total-subarray-value-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 an integer array nums of length n and an integer k.\n\nYou n...
split-and-merge-array-transformation
split-and-merge-array-transformation__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 two integer arrays nums1 and nums2, each of length n. You ma...
climbing-stairs-ii
climbing-stairs-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 climbing a staircase with n + 1 steps, numbered from 0 to n.\n\nYo...
distinct-points-reachable-after-substring-removal
distinct-points-reachable-after-substring-removal__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 string s consisting of characters 'U', 'D', 'L', and 'R', ...
maximize-alternating-sum-using-swaps
maximize-alternating-sum-using-swaps__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 integer array nums.\n\nYou want to maximize the alternati...
compute-decimal-representation
compute-decimal-representation__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\nA positive integer is a base-10 com...
split-array-with-minimum-difference
split-array-with-minimum-difference__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 integer array nums.\n\nSplit the array into exactly two s...
number-of-zigzag-arrays-i
number-of-zigzag-arrays-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\nYou are given three integers n, l, and r.\n\nA ZigZag array of length n is...
number-of-zigzag-arrays-ii
number-of-zigzag-arrays-ii__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 three integers n, l, and r.\n\nA ZigZag array of length n is...