slug
stringlengths
3
79
solution_id
stringlengths
13
89
primary_algorithm
stringclasses
22 values
verified
null
messages
listlengths
3
3
find-the-number-of-good-pairs-ii
find-the-number-of-good-pairs-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 2 integer arrays nums1 and nums2 of lengths n and m respecti...
maximum-sum-of-subsequence-with-non-adjacent-elements
maximum-sum-of-subsequence-with-non-adjacent-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 array nums consisting of integers. You are also given a 2...
better-compression-of-string
better-compression-of-string__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 string compressed representing a compressed version of a s...
minimum-number-of-chairs-in-a-waiting-room
minimum-number-of-chairs-in-a-waiting-room__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. Simulate events at each second i:\n\n\tIf s[i] =...
count-days-without-meetings
count-days-without-meetings__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 days representing the total number of day...
lexicographically-minimum-string-after-removing-stars
lexicographically-minimum-string-after-removing-stars__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. It may contain any number of '*' characters. You...
find-subarray-with-bitwise-or-closest-to-k
find-subarray-with-bitwise-or-closest-to-k__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 an array nums and an integer k. You need to find a subarray ...
find-subarray-with-bitwise-or-closest-to-k
find-subarray-with-bitwise-or-closest-to-k__02__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 and an integer k. You need to find a subarray ...
bitwise-or-of-adjacent-elements
bitwise-or-of-adjacent-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\nGiven an array nums of length n, return an array answer of length n - 1 su...
clear-digits
clear-digits__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.\n\nYour task is to remove all digits by doing th...
find-the-first-player-to-win-k-games-in-a-row
find-the-first-player-to-win-k-games-in-a-row__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\nA competition consists of n players numbered from 0 to n - 1.\n\nYou are g...
find-the-maximum-length-of-a-good-subsequence-i
find-the-maximum-length-of-a-good-subsequence-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 an integer array nums and a non-negative integer k. A sequen...
find-the-maximum-length-of-a-good-subsequence-i
find-the-maximum-length-of-a-good-subsequence-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 integer array nums and a non-negative integer k. A sequen...
find-the-maximum-length-of-a-good-subsequence-ii
find-the-maximum-length-of-a-good-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 a non-negative integer k. A sequen...
find-the-child-who-has-the-ball-after-k-seconds
find-the-child-who-has-the-ball-after-k-seconds__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 k. There are n children numbered...
find-the-n-th-value-after-k-seconds
find-the-n-th-value-after-k-seconds__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 n and k.\n\nInitially, you start with an array ...
maximum-total-reward-using-operations-i
maximum-total-reward-using-operations-i__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 rewardValues of length n, representing the ...
maximum-total-reward-using-operations-i
maximum-total-reward-using-operations-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 integer array rewardValues of length n, representing the ...
maximum-total-reward-using-operations-i
maximum-total-reward-using-operations-i__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 integer array rewardValues of length n, representing the ...
maximum-total-reward-using-operations-ii
maximum-total-reward-using-operations-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 rewardValues of length n, representing the ...
the-number-of-ways-to-make-the-sum
the-number-of-ways-to-make-the-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 have an infinite number of coins with values 1, 2, and 6, and only 2 c...
the-number-of-ways-to-make-the-sum
the-number-of-ways-to-make-the-sum__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 have an infinite number of coins with values 1, 2, and 6, and only 2 c...
count-pairs-that-form-a-complete-day-i
count-pairs-that-form-a-complete-day-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\nGiven an integer array hours representing times in hours, return an intege...
count-pairs-that-form-a-complete-day-ii
count-pairs-that-form-a-complete-day-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\nGiven an integer array hours representing times in hours, return an intege...
maximum-total-damage-with-spell-casting
maximum-total-damage-with-spell-casting__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\nA magician has various spells.\n\nYou are given an array power, where each...
peaks-in-array
peaks-in-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\nA peak in an array arr is an element that is greater than its previous and...
minimum-moves-to-get-a-peaceful-board
minimum-moves-to-get-a-peaceful-board__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 2D array rooks of length n, where rooks[i] = [xi, yi] indicates th...
find-minimum-operations-to-make-all-elements-divisible-by-three
find-minimum-operations-to-make-all-elements-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\nYou are given an integer array nums. In one operation, you can add or subt...
minimum-operations-to-make-binary-array-elements-equal-to-one-i
minimum-operations-to-make-binary-array-elements-equal-to-one-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 binary array nums.\n\nYou can do the following operation o...
minimum-operations-to-make-binary-array-elements-equal-to-one-ii
minimum-operations-to-make-binary-array-elements-equal-to-one-ii__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 binary array nums.\n\nYou can do the following operation o...
count-the-number-of-inversions
count-the-number-of-inversions__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 a 2D array requirements, where requirements...
minimum-average-of-smallest-and-largest-elements
minimum-average-of-smallest-and-largest-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 have an array of floating point numbers averages which is initially em...
find-the-minimum-area-to-cover-all-ones-i
find-the-minimum-area-to-cover-all-ones-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 2D binary array grid. Find a rectangle with horizontal and...
maximize-total-cost-of-alternating-subarrays
maximize-total-cost-of-alternating-subarrays__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 with length n.\n\nThe cost of a subarr...
maximize-total-cost-of-alternating-subarrays
maximize-total-cost-of-alternating-subarrays__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 nums with length n.\n\nThe cost of a subarr...
find-the-minimum-area-to-cover-all-ones-ii
find-the-minimum-area-to-cover-all-ones-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 2D binary array grid. You need to find 3 non-overlapping r...
count-triplets-with-even-xor-set-bits-i
count-triplets-with-even-xor-set-bits-i__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 three integer arrays a, b, and c, return the number of triplets (a[i...
maximum-height-of-a-triangle
maximum-height-of-a-triangle__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 red and blue representing the count of red and ...
find-the-maximum-length-of-valid-subsequence-i
find-the-maximum-length-of-valid-subsequence-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 an integer array nums.\n\nA subsequence sub of nums with len...
find-the-maximum-length-of-valid-subsequence-ii
find-the-maximum-length-of-valid-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 a positive integer k.\n\nA subsequ...
find-minimum-diameter-after-merging-two-trees
find-minimum-diameter-after-merging-two-trees__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 exist two undirected trees with n and m nodes, numbered from 0 to n ...
maximum-array-hopping-score-i
maximum-array-hopping-score-i__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 an array nums, you have to get the maximum score starting from index...
maximum-array-hopping-score-i
maximum-array-hopping-score-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\nGiven an array nums, you have to get the maximum score starting from index...
maximum-array-hopping-score-i
maximum-array-hopping-score-i__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\nGiven an array nums, you have to get the maximum score starting from index...
alternating-groups-i
alternating-groups-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\nThere is a circle of red and blue tiles. You are given an array of integer...
maximum-points-after-enemy-battles
maximum-points-after-enemy-battles__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 enemyEnergies denoting the energy values of...
alternating-groups-ii
alternating-groups-ii__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\nThere is a circle of red and blue tiles. You are given an array of integer...
number-of-subarrays-with-and-value-of-k
number-of-subarrays-with-and-value-of-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\nGiven an array of integers nums and an integer k, return the number of sub...
find-the-encrypted-string
find-the-encrypted-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\nYou are given a string s and an integer k. Encrypt the string using the fo...
generate-binary-strings-without-adjacent-zeros
generate-binary-strings-without-adjacent-zeros__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 positive integer n.\n\nA binary string x is valid if all s...
count-submatrices-with-equal-frequency-of-x-and-y
count-submatrices-with-equal-frequency-of-x-and-y__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 2D character matrix grid, where grid[i][j] is either 'X', 'Y', or ...
construct-string-with-minimum-cost
construct-string-with-minimum-cost__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 target, an array of strings words, and an integer a...
count-triplets-with-even-xor-set-bits-ii
count-triplets-with-even-xor-set-bits-ii__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 three integer arrays a, b, and c, return the number of triplets (a[i...
lexicographically-smallest-string-after-a-swap
lexicographically-smallest-string-after-a-swap__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 containing only digits, return the lexicographically smal...
delete-nodes-from-linked-list-present-in-array
delete-nodes-from-linked-list-present-in-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 an array of integers nums and the head of a linked list. Ret...
minimum-cost-for-cutting-cake-i
minimum-cost-for-cutting-cake-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\nThere is an m x n cake that needs to be cut into 1 x 1 pieces.\n\nYou are ...
minimum-cost-for-cutting-cake-ii
minimum-cost-for-cutting-cake-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\nThere is an m x n cake that needs to be cut into 1 x 1 pieces.\n\nYou are ...
maximum-array-hopping-score-ii
maximum-array-hopping-score-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\nGiven an array nums, you have to get the maximum score starting from index...
find-the-winning-player-in-coin-game
find-the-winning-player-in-coin-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\nYou are given two positive integers x and y, denoting the number of coins ...
minimum-length-of-string-after-operations
minimum-length-of-string-after-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 a string s.\n\nYou can perform the following process on s an...
minimum-array-changes-to-make-differences-equal
minimum-array-changes-to-make-differences-equal__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 of size n where n is even, and an inte...
maximum-score-from-grid-operations
maximum-score-from-grid-operations__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 2D matrix grid of size n x n. Initially, all cells of the ...
number-of-bit-changes-to-make-two-integers-equal
number-of-bit-changes-to-make-two-integers-equal__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 positive integers n and k.\n\nYou can choose any bit in ...
vowels-game-in-a-string
vowels-game-in-a-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\nAlice and Bob are playing a game on a string.\n\nYou are given a string s,...
maximum-number-of-operations-to-move-ones-to-the-end
maximum-number-of-operations-to-move-ones-to-the-end__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.\n\nYou can perform the following operatio...
minimum-operations-to-make-array-equal-to-target
minimum-operations-to-make-array-equal-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 positive integer arrays nums and target, of the same len...
minimum-number-of-increasing-subsequence-to-be-removed
minimum-number-of-increasing-subsequence-to-be-removed__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 array of integers nums, you are allowed to perform the following ...
find-if-digit-game-can-be-won
find-if-digit-game-can-be-won__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 positive integers nums.\n\nAlice and Bob are pla...
find-the-count-of-numbers-which-are-not-special
find-the-count-of-numbers-which-are-not-special__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 2 positive integers l and r. For any number x, all positive ...
count-the-number-of-substrings-with-dominant-ones
count-the-number-of-substrings-with-dominant-ones__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 binary string s.\n\nReturn the number of substrings with d...
check-if-the-rectangle-corner-is-reachable
check-if-the-rectangle-corner-is-reachable__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 two positive integers xCorner and yCorner, and a 2D array ci...
alt-and-tab-simulation
alt-and-tab-simulation__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\nThere are n windows open numbered from 1 to n, we want to simulate using a...
find-the-number-of-winning-players
find-the-number-of-winning-players__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 n representing the number of players in a game an...
minimum-number-of-flips-to-make-binary-grid-palindromic-i
minimum-number-of-flips-to-make-binary-grid-palindromic-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 an m x n binary matrix grid.\n\nA row or column is considere...
minimum-number-of-flips-to-make-binary-grid-palindromic-ii
minimum-number-of-flips-to-make-binary-grid-palindromic-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 an m x n binary matrix grid.\n\nA row or column is considere...
time-taken-to-mark-all-nodes
time-taken-to-mark-all-nodes__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 exists an undirected tree with n nodes numbered 0 to n - 1. You are ...
design-neighbor-sum-service
design-neighbor-sum-service__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 n x n 2D array grid containing distinct elements in the ra...
shortest-distance-after-road-addition-queries-i
shortest-distance-after-road-addition-queries-i__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 n and a 2D integer array queries.\n\nThere are n ...
shortest-distance-after-road-addition-queries-ii
shortest-distance-after-road-addition-queries-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 an integer n and a 2D integer array queries.\n\nThere are n ...
alternating-groups-iii
alternating-groups-iii__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 some red and blue tiles arranged circularly. You are given an ar...
number-of-subsequences-with-odd-sum
number-of-subsequences-with-odd-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\nGiven an array nums, return the number of subsequences with an odd sum of ...
snake-in-matrix
snake-in-matrix__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 a snake in an n x n matrix grid and can move in four possible dir...
count-the-number-of-good-nodes
count-the-number-of-good-nodes__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, and root...
find-the-count-of-monotonic-pairs-i
find-the-count-of-monotonic-pairs-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 an array of positive integers nums of length n.\n\nWe call a...
find-the-count-of-monotonic-pairs-ii
find-the-count-of-monotonic-pairs-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 array of positive integers nums of length n.\n\nWe call a...
construct-string-with-minimum-cost-easy
construct-string-with-minimum-cost-easy__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 a string target, an array of strings words, and an integer a...
find-the-power-of-k-size-subarrays-i
find-the-power-of-k-size-subarrays-i__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 an array of integers nums of length n and a positive integer...
find-the-power-of-k-size-subarrays-ii
find-the-power-of-k-size-subarrays-ii__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 an array of integers nums of length n and a positive integer...
maximum-value-sum-by-placing-three-rooks-i
maximum-value-sum-by-placing-three-rooks-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 a m x n 2D array board representing a chessboard, where boar...
maximum-value-sum-by-placing-three-rooks-ii
maximum-value-sum-by-placing-three-rooks-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 m x n 2D array board representing a chessboard, where boar...
count-substrings-that-satisfy-k-constraint-i
count-substrings-that-satisfy-k-constraint-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 binary string s and an integer k.\n\nA binary string satis...
maximum-energy-boost-from-two-drinks
maximum-energy-boost-from-two-drinks__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 integer arrays energyDrinkA and energyDrinkB of the same...
maximum-energy-boost-from-two-drinks
maximum-energy-boost-from-two-drinks__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 integer arrays energyDrinkA and energyDrinkB of the same...
find-the-largest-palindrome-divisible-by-k
find-the-largest-palindrome-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 two positive integers n and k.\n\nAn integer x is called k-p...
count-substrings-that-satisfy-k-constraint-ii
count-substrings-that-satisfy-k-constraint-ii__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 an integer k.\n\nYou are also given a ...
convert-doubly-linked-list-to-array-i
convert-doubly-linked-list-to-array-i__01__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 doubly linked list, which contains nodes that ...
final-array-state-after-k-multiplication-operations-i
final-array-state-after-k-multiplication-operations-i__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 array nums, an integer k, and an integer multipli...
count-almost-equal-pairs-i
count-almost-equal-pairs-i__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 nums consisting of positive integers.\n\nWe call tw...
final-array-state-after-k-multiplication-operations-ii
final-array-state-after-k-multiplication-operations-ii__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 array nums, an integer k, and an integer multipli...
count-almost-equal-pairs-ii
count-almost-equal-pairs-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\nAttention: In this version, the number of operations that can be performed...