slug
stringlengths
3
79
solution_id
stringlengths
13
89
primary_algorithm
stringclasses
22 values
verified
null
messages
listlengths
3
3
find-maximum-non-decreasing-array-length
find-maximum-non-decreasing-array-length__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\nYou can perform any numbe...
matrix-similarity-after-cyclic-shifts
matrix-similarity-after-cyclic-shifts__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 mat and an integer k. The matrix row...
count-beautiful-substrings-i
count-beautiful-substrings-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 and a positive integer k.\n\nLet vowels and conso...
make-lexicographically-smallest-array-by-swapping-elements
make-lexicographically-smallest-array-by-swapping-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 0-indexed array of positive integers nums and a positive i...
number-of-divisible-substrings
number-of-divisible-substrings__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\nEach character of the English alphabet has been mapped to a digit as shown...
number-of-divisible-substrings
number-of-divisible-substrings__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\nEach character of the English alphabet has been mapped to a digit as shown...
find-the-peaks
find-the-peaks__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 mountain. Your task is to find all the pea...
minimum-number-of-coins-to-be-added
minimum-number-of-coins-to-be-added__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 coins, representing the values of ...
count-complete-substrings
count-complete-substrings__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 string word and an integer k.\n\nA substring s of word is ...
count-the-number-of-infection-sequences
count-the-number-of-infection-sequences__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 and an array sick sorted in increasing order, r...
number-of-same-end-substrings
number-of-same-end-substrings__01__java
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed string s, and a 2D array of integers queries, wh...
find-common-elements-between-two-arrays
find-common-elements-between-two-arrays__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 sizes n and m, respect...
remove-adjacent-almost-equal-characters
remove-adjacent-almost-equal-characters__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 string word.\n\nIn one operation, you can pick a...
length-of-longest-subarray-with-at-most-k-frequency
length-of-longest-subarray-with-at-most-k-frequency__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 integer array nums and an integer k.\n\nThe frequency of ...
number-of-possible-sets-of-closing-branches
number-of-possible-sets-of-closing-branches__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 is a company with n branches across the country, some of which are c...
count-tested-devices-after-test-operations
count-tested-devices-after-test-operations__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array batteryPercentages having length n...
double-modular-exponentiation
double-modular-exponentiation__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 2D array variables where variables[i] = [ai, bi,...
count-subarrays-where-max-element-appears-at-least-k-times
count-subarrays-where-max-element-appears-at-least-k-times__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 integer array nums and a positive integer k.\n\nReturn th...
count-the-number-of-good-partitions
count-the-number-of-good-partitions__01__java
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed array nums consisting of positive integers.\n\nA...
number-of-divisible-triplet-sums
number-of-divisible-triplet-sums__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 0-indexed integer array nums and an integer d, return the number o...
find-missing-and-repeated-values
find-missing-and-repeated-values__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 2D integer matrix grid of size n * n with values...
divide-array-into-arrays-with-max-difference
divide-array-into-arrays-with-max-difference__01__java
Sorting
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums of size n where n is a multiple of 3 a...
minimum-cost-to-make-array-equalindromic
minimum-cost-to-make-array-equalindromic__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 integer array nums having length n.\n\nYou are a...
apply-operations-to-maximize-frequency-score
apply-operations-to-maximize-frequency-score__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 integer array nums and an integer k.\n\nYou can ...
minimum-number-of-coins-for-fruits-ii
minimum-number-of-coins-for-fruits-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 at a fruit market with different types of exotic fruits on display...
count-the-number-of-incremovable-subarrays-i
count-the-number-of-incremovable-subarrays-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 array of positive integers nums.\n\nA subarray o...
find-polygon-with-the-largest-perimeter
find-polygon-with-the-largest-perimeter__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 of positive integers nums of length n.\n\nA polygon...
count-the-number-of-incremovable-subarrays-ii
count-the-number-of-incremovable-subarrays-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 array of positive integers nums.\n\nA subarray o...
find-number-of-coins-to-place-in-tree-nodes
find-number-of-coins-to-place-in-tree-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\nYou are given an undirected tree with n nodes labeled from 0 to n - 1, and...
minimum-number-game
minimum-number-game__01__java
Heap
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array nums of even length and there is a...
minimum-number-game
minimum-number-game__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 of even length and there is a...
maximum-square-area-by-removing-fences-from-a-field
maximum-square-area-by-removing-fences-from-a-field__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 is a large (m - 1) x (n - 1) rectangular field with corners at (1, 1...
minimum-cost-to-convert-string-i
minimum-cost-to-convert-string-i__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 two 0-indexed strings source and target, both of length n an...
minimum-cost-to-convert-string-ii
minimum-cost-to-convert-string-ii__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 strings source and target, both of length n an...
most-expensive-item-that-can-not-be-bought
most-expensive-item-that-can-not-be-bought__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 distinct prime numbers primeOne and primeTwo.\n\nAlice a...
check-if-bitwise-or-has-trailing-zeros
check-if-bitwise-or-has-trailing-zeros__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 of positive integers nums.\n\nYou have to check if ...
find-longest-special-substring-that-occurs-thrice-i
find-longest-special-substring-that-occurs-thrice-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 string s that consists of lowercase English letters.\n\nA ...
find-longest-special-substring-that-occurs-thrice-ii
find-longest-special-substring-that-occurs-thrice-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 string s that consists of lowercase English letters.\n\nA ...
palindrome-rearrangement-queries
palindrome-rearrangement-queries__01__java
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed string s having an even length n.\n\nYou are als...
number-of-self-divisible-permutations
number-of-self-divisible-permutations__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 integer n, return the number of permutations of the 1-indexed arr...
number-of-self-divisible-permutations
number-of-self-divisible-permutations__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 integer n, return the number of permutations of the 1-indexed arr...
smallest-missing-integer-greater-than-sequential-prefix-sum
smallest-missing-integer-greater-than-sequential-prefix-sum__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed array of integers nums.\n\nA prefix nums[0..i] i...
minimum-number-of-operations-to-make-array-xor-equal-to-k
minimum-number-of-operations-to-make-array-xor-equal-to-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\nYou are given a 0-indexed integer array nums and a positive integer k.\n\n...
minimum-number-of-operations-to-make-x-and-y-equal
minimum-number-of-operations-to-make-x-and-y-equal__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 x and y.\n\nIn one operation, you can ...
count-the-number-of-powerful-integers
count-the-number-of-powerful-integers__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 three integers start, finish, and limit. You are also given ...
maximum-area-of-longest-diagonal-rectangle
maximum-area-of-longest-diagonal-rectangle__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 0-indexed integer array dimensions.\n\nFor all indices ...
minimum-moves-to-capture-the-queen
minimum-moves-to-capture-the-queen__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 1-indexed 8 x 8 chessboard containing 3 pieces.\n\nYou are give...
maximum-size-of-a-set-after-removals
maximum-size-of-a-set-after-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\nYou are given two 0-indexed integer arrays nums1 and nums2 of even length ...
maximize-the-number-of-partitions-after-operations
maximize-the-number-of-partitions-after-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 string s and an integer k.\n\nFirst, you are allowed to ch...
maximum-subtree-of-the-same-color
maximum-subtree-of-the-same-color__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 2D integer array edges representing a tree with n nodes, n...
count-elements-with-maximum-frequency
count-elements-with-maximum-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 an array nums consisting of positive integers.\n\nReturn the...
find-beautiful-indices-in-the-given-array-i
find-beautiful-indices-in-the-given-array-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 string s, a string a, a string b, and an integer...
maximum-number-that-sum-of-the-prices-is-less-than-or-equal-to-k
maximum-number-that-sum-of-the-prices-is-less-than-or-equal-to-k__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 k and an integer x. The price of a number num is ...
find-beautiful-indices-in-the-given-array-ii
find-beautiful-indices-in-the-given-array-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 string s, a string a, a string b, and an integer...
maximum-number-of-intersections-on-the-chart
maximum-number-of-intersections-on-the-chart__01__java
Sorting
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nThere is a line chart consisting of n points connected by line segments. Y...
divide-an-array-into-subarrays-with-minimum-cost-i
divide-an-array-into-subarrays-with-minimum-cost-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 of integers nums of length n.\n\nThe cost of an arr...
find-if-array-can-be-sorted
find-if-array-can-be-sorted__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 array of positive integers nums.\n\nIn one opera...
minimize-length-of-array-using-operations
minimize-length-of-array-using-operations__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 containing positive integers....
divide-an-array-into-subarrays-with-minimum-cost-ii
divide-an-array-into-subarrays-with-minimum-cost-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 0-indexed array of integers nums of length n, and two posi...
minimum-number-of-pushes-to-type-word-i
minimum-number-of-pushes-to-type-word-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 word containing distinct lowercase English letters....
count-the-number-of-houses-at-a-certain-distance-i
count-the-number-of-houses-at-a-certain-distance-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 three positive integers n, x, and y.\n\nIn a city, there exi...
minimum-number-of-pushes-to-type-word-ii
minimum-number-of-pushes-to-type-word-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 a string word containing lowercase English letters.\n\nTelep...
count-the-number-of-houses-at-a-certain-distance-ii
count-the-number-of-houses-at-a-certain-distance-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\nYou are given three positive integers n, x, and y.\n\nIn a city, there exi...
maximum-number-of-removal-queries-that-can-be-processed-i
maximum-number-of-removal-queries-that-can-be-processed-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 0-indexed array nums and a 0-indexed array queries.\n\nYou...
number-of-changing-keys
number-of-changing-keys__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 string s typed by a user. Changing a key is defi...
find-the-maximum-number-of-elements-in-subset
find-the-maximum-number-of-elements-in-subset__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 positive integers nums.\n\nYou need to select a ...
alice-and-bob-playing-flower-game
alice-and-bob-playing-flower-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 are playing a turn-based game on a field, with two lanes of ...
alice-and-bob-playing-flower-game
alice-and-bob-playing-flower-game__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\nAlice and Bob are playing a turn-based game on a field, with two lanes of ...
minimize-or-of-remaining-elements-using-operations
minimize-or-of-remaining-elements-using-operations__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 an integer k.\n\nIn one o...
find-pattern-in-infinite-stream-i
find-pattern-in-infinite-stream-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 array pattern and an object stream of class Infinit...
type-of-triangle
type-of-triangle__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 size 3 which can form the ...
find-the-number-of-ways-to-place-people-i
find-the-number-of-ways-to-place-people-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 a 2D array points of size n x 2 representing integer coordin...
maximum-good-subarray-sum
maximum-good-subarray-sum__01__java
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an array nums of length n and a positive integer k.\n\nA sub...
find-the-number-of-ways-to-place-people-ii
find-the-number-of-ways-to-place-people-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 2D array points of size n x 2 representing integer coordin...
ant-on-the-boundary
ant-on-the-boundary__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\nAn ant is on a boundary. It sometimes goes left and sometimes right.\n\nYo...
minimum-time-to-revert-word-to-initial-state-i
minimum-time-to-revert-word-to-initial-state-i__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 string word and an integer k.\n\nAt every second...
minimum-time-to-revert-word-to-initial-state-i
minimum-time-to-revert-word-to-initial-state-i__02__java
String
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed string word and an integer k.\n\nAt every second...
find-the-grid-of-region-average
find-the-grid-of-region-average__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 m x n grid image which represents a grayscale image, where i...
minimum-time-to-revert-word-to-initial-state-ii
minimum-time-to-revert-word-to-initial-state-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 0-indexed string word and an integer k.\n\nAt every second...
count-numbers-with-unique-digits-ii
count-numbers-with-unique-digits-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\nGiven two positive integers a and b, return the count of numbers having un...
count-numbers-with-unique-digits-ii
count-numbers-with-unique-digits-ii__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 two positive integers a and b, return the count of numbers having un...
modify-the-matrix
modify-the-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\nGiven a 0-indexed m x n integer matrix matrix, create a new 0-indexed matr...
number-of-subarrays-that-match-a-pattern-i
number-of-subarrays-that-match-a-pattern-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 of size n, and a 0-indexed in...
maximum-palindromes-after-operations
maximum-palindromes-after-operations__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 string array words having length n and containin...
number-of-subarrays-that-match-a-pattern-ii
number-of-subarrays-that-match-a-pattern-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 of size n, and a 0-indexed in...
find-pattern-in-infinite-stream-ii
find-pattern-in-infinite-stream-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 array pattern and an object stream of class Infinit...
maximum-number-of-operations-with-the-same-score-i
maximum-number-of-operations-with-the-same-score-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 of integers nums. Consider the following operation:...
apply-operations-to-make-string-empty
apply-operations-to-make-string-empty__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\nConsider performing the following operation u...
maximum-number-of-operations-with-the-same-score-ii
maximum-number-of-operations-with-the-same-score-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\nGiven an array of integers called nums, you can perform any of the followi...
maximize-consecutive-elements-in-an-array-after-modification
maximize-consecutive-elements-in-an-array-after-modification__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 consisting of positive integers.\n\nI...
count-prefix-and-suffix-pairs-i
count-prefix-and-suffix-pairs-i__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 0-indexed string array words.\n\nLet's define a boolean fu...
count-prefix-and-suffix-pairs-i
count-prefix-and-suffix-pairs-i__02__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 0-indexed string array words.\n\nLet's define a boolean fu...
find-the-length-of-the-longest-common-prefix
find-the-length-of-the-longest-common-prefix__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 arrays with positive integers arr1 and arr2.\n\nA prefix...
most-frequent-prime
most-frequent-prime__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 m x n 0-indexed 2D matrix mat. From every cell, you can cr...
count-prefix-and-suffix-pairs-ii
count-prefix-and-suffix-pairs-ii__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 0-indexed string array words.\n\nLet's define a boolean fu...
split-the-array
split-the-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 integer array nums of even length. You have to split the ...
find-the-largest-area-of-square-inside-two-rectangles
find-the-largest-area-of-square-inside-two-rectangles__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 exist n rectangles in a 2D plane with edges parallel to the x and y ...
earliest-second-to-mark-indices-i
earliest-second-to-mark-indices-i__01__java
Binary Search
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given two 1-indexed integer arrays, nums and, changeIndices, havin...
earliest-second-to-mark-indices-ii
earliest-second-to-mark-indices-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 1-indexed integer arrays, nums and, changeIndices, havin...
winner-of-the-linked-list-game
winner-of-the-linked-list-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 the head of a linked list of even length containing integers...