slug
stringlengths
3
79
solution_id
stringlengths
13
89
primary_algorithm
stringclasses
22 values
verified
null
messages
listlengths
3
3
constructing-two-increasing-arrays
constructing-two-increasing-arrays__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 2 integer arrays nums1 and nums2 consisting only of 0 and 1, your ta...
find-the-key-of-the-numbers
find-the-key-of-the-numbers__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 positive integers num1, num2, and num3.\n\nThe key of ...
hash-divided-string
hash-divided-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 of length n and an integer k, where n is a multip...
find-the-count-of-good-integers
find-the-count-of-good-integers__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given two positive integers n and k.\n\nAn integer x is called k-p...
minimum-amount-of-damage-dealt-to-bob
minimum-amount-of-damage-dealt-to-bob__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 power and two integer arrays damage and health, b...
check-if-two-chessboard-squares-have-the-same-color
check-if-two-chessboard-squares-have-the-same-color__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 strings, coordinate1 and coordinate2, representing the c...
k-th-nearest-obstacle-queries
k-th-nearest-obstacle-queries__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\nThere is an infinite 2D plane.\n\nYou are given a positive integer k. You ...
select-cells-in-grid-with-maximum-score
select-cells-in-grid-with-maximum-score__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 consisting of positive integers.\n\nYou hav...
maximum-xor-score-subarray-queries
maximum-xor-score-subarray-queries__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 of n integers, and a 2D integer array queries ...
maximum-total-area-occupied-by-pistons
maximum-total-area-occupied-by-pistons__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 several pistons in an old car engine, and we want to calculate t...
convert-date-to-binary
convert-date-to-binary__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 date representing a Gregorian calendar date in the ...
maximize-score-of-numbers-in-ranges
maximize-score-of-numbers-in-ranges__01__java
Binary Search
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an array of integers start and an integer d, representing n ...
reach-end-of-array-with-max-score
reach-end-of-array-with-max-score__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.\n\nYour goal is to start ...
maximum-number-of-moves-to-kill-all-pawns
maximum-number-of-moves-to-kill-all-pawns__01__java
Memoization
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nThere is a 50 x 50 chessboard with one knight and some pawns on it. You ar...
sum-of-consecutive-subarrays
sum-of-consecutive-subarrays__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\nWe call an array arr of length n consecutive if one of the following holds...
find-indices-of-stable-mountains
find-indices-of-stable-mountains__01__java
Array
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nThere are n mountains in a row, and each mountain has a height. You are gi...
find-a-safe-walk-through-a-grid
find-a-safe-walk-through-a-grid__01__java
BFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an m x n binary matrix grid and an integer health.\n\nYou st...
find-the-maximum-sequence-value-of-array
find-the-maximum-sequence-value-of-array__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\nThe value...
length-of-the-longest-increasing-path
length-of-the-longest-increasing-path__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 2D array of integers coordinates of length n and an intege...
the-two-sneaky-numbers-of-digitville
the-two-sneaky-numbers-of-digitville__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\nIn the town of Digitville, there was a list of numbers called nums contain...
the-two-sneaky-numbers-of-digitville
the-two-sneaky-numbers-of-digitville__02__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\nIn the town of Digitville, there was a list of numbers called nums contain...
maximum-multiplication-score
maximum-multiplication-score__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 a of size 4 and another integer array b of ...
minimum-number-of-valid-strings-to-form-target-i
minimum-number-of-valid-strings-to-form-target-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 array of strings words and a string target.\n\nA string x...
minimum-number-of-valid-strings-to-form-target-ii
minimum-number-of-valid-strings-to-form-target-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 array of strings words and a string target.\n\nA string x...
convert-doubly-linked-list-to-array-ii
convert-doubly-linked-list-to-array-ii__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 an arbitrary node from a doubly linked list, which contains ...
report-spam-message
report-spam-message__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 strings message and an array of strings bannedWo...
minimum-number-of-seconds-to-make-mountain-height-zero
minimum-number-of-seconds-to-make-mountain-height-zero__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 mountainHeight denoting the height of a mountain....
count-substrings-that-can-be-rearranged-to-contain-a-string-i
count-substrings-that-can-be-rearranged-to-contain-a-string-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 two strings word1 and word2.\n\nA string x is called valid i...
count-substrings-that-can-be-rearranged-to-contain-a-string-ii
count-substrings-that-can-be-rearranged-to-contain-a-string-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 two strings word1 and word2.\n\nA string x is called valid i...
sum-of-consecutive-subsequences
sum-of-consecutive-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\nWe call an array arr of length n consecutive if one of the following holds...
minimum-element-after-replacement-with-digit-sum
minimum-element-after-replacement-with-digit-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 an integer array nums.\n\nYou replace each element in nums w...
maximize-the-total-height-of-unique-towers
maximize-the-total-height-of-unique-towers__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 maximumHeight, where maximumHeight[i] denotes the m...
find-the-lexicographically-smallest-valid-sequence
find-the-lexicographically-smallest-valid-sequence__01__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given two strings word1 and word2.\n\nA string x is called almost ...
find-the-occurrence-of-first-almost-equal-substring
find-the-occurrence-of-first-almost-equal-substring__01__java
String
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given two strings s and pattern.\n\nA string x is called almost eq...
find-the-k-th-character-in-string-game-i
find-the-k-th-character-in-string-game-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\nAlice and Bob are playing a game. Initially, Alice has a string word = \"a...
count-of-substrings-containing-every-vowel-and-k-consonants-i
count-of-substrings-containing-every-vowel-and-k-consonants-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 word and a non-negative integer k.\n\nReturn the to...
count-of-substrings-containing-every-vowel-and-k-consonants-ii
count-of-substrings-containing-every-vowel-and-k-consonants-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 word and a non-negative integer k.\n\nReturn the to...
find-the-k-th-character-in-string-game-ii
find-the-k-th-character-in-string-game-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\nAlice and Bob are playing a game. Initially, Alice has a string word = \"a...
maximum-possible-number-by-binary-concatenation
maximum-possible-number-by-binary-concatenation__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 integers nums of size 3.\n\nReturn the maximum p...
remove-methods-from-project
remove-methods-from-project__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 maintaining a project that has n methods numbered from 0 to n - 1....
construct-2d-grid-matching-graph-layout
construct-2d-grid-matching-graph-layout__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 2D integer array edges representing an undirected graph ha...
sorted-gcd-pair-queries
sorted-gcd-pair-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 integer array queri...
find-the-last-marked-nodes-in-tree
find-the-last-marked-nodes-in-tree__01__java
DFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nThere exists an undirected tree with n nodes numbered 0 to n - 1. You are ...
construct-the-minimum-bitwise-array-i
construct-the-minimum-bitwise-array-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\nYou are given an array nums consisting of n prime integers.\n\nYou need to...
construct-the-minimum-bitwise-array-ii
construct-the-minimum-bitwise-array-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 an array nums consisting of n prime integers.\n\nYou need to...
find-maximum-removals-from-source-string
find-maximum-removals-from-source-string__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 source of size n, a string pattern that is a subseq...
find-the-number-of-possible-ways-for-an-event
find-the-number-of-possible-ways-for-an-event__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 n, x, and y.\n\nAn event is being held for n ...
find-x-sum-of-all-k-long-subarrays-i
find-x-sum-of-all-k-long-subarrays-i__01__java
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an array nums of n integers and two integers k and x.\n\nThe...
k-th-largest-perfect-subtree-size-in-binary-tree
k-th-largest-perfect-subtree-size-in-binary-tree__01__java
DFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given the root of a binary tree and an integer k.\n\nReturn an int...
count-the-number-of-winning-sequences
count-the-number-of-winning-sequences__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\nAlice and Bob are playing a fantasy battle game consisting of n rounds whe...
find-x-sum-of-all-k-long-subarrays-ii
find-x-sum-of-all-k-long-subarrays-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 an array nums of n integers and two integers k and x.\n\nThe...
minimize-connected-groups-by-inserting-interval
minimize-connected-groups-by-inserting-interval__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 2D array intervals, where intervals[i] = [starti, endi] re...
find-the-sequence-of-strings-appeared-on-the-screen
find-the-sequence-of-strings-appeared-on-the-screen__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 target.\n\nAlice is going to type target on her com...
count-substrings-with-k-frequency-characters-i
count-substrings-with-k-frequency-characters-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\nGiven a string s and an integer k, return the total number of substrings o...
minimum-division-operations-to-make-array-non-decreasing
minimum-division-operations-to-make-array-non-decreasing__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\nAny positive divisor of a natural ...
check-if-dfs-strings-are-palindromes
check-if-dfs-strings-are-palindromes__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 tree rooted at node 0, consisting of n nodes numbered from...
count-substrings-with-k-frequency-characters-ii
count-substrings-with-k-frequency-characters-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\nGiven a string s and an integer k, return the total number of substrings o...
find-the-original-typed-string-i
find-the-original-typed-string-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\nAlice is attempting to type a specific string on her computer. However, sh...
find-subtree-sizes-after-changes
find-subtree-sizes-after-changes__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 tree rooted at node 0 that consists of n nodes numbered fr...
maximum-points-tourist-can-earn
maximum-points-tourist-can-earn__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, along with two 2D integer arrays, sta...
find-the-original-typed-string-ii
find-the-original-typed-string-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\nAlice is attempting to type a specific string on her computer. However, sh...
find-the-maximum-factor-score-of-array
find-the-maximum-factor-score-of-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\nThe factor score of an array is de...
total-characters-in-string-after-transformations-i
total-characters-in-string-after-transformations-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 string s and an integer t, representing the number of tran...
find-the-number-of-subsequences-with-equal-gcd
find-the-number-of-subsequences-with-equal-gcd__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 the number of...
total-characters-in-string-after-transformations-ii
total-characters-in-string-after-transformations-ii__01__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a string s consisting of lowercase English letters, an integ...
find-the-number-of-k-even-arrays
find-the-number-of-k-even-arrays__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 three integers n, m, and k.\n\nAn array arr is called k-even...
find-the-number-of-k-even-arrays
find-the-number-of-k-even-arrays__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 three integers n, m, and k.\n\nAn array arr is called k-even...
find-the-number-of-k-even-arrays
find-the-number-of-k-even-arrays__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 three integers n, m, and k.\n\nAn array arr is called k-even...
check-balanced-string
check-balanced-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 num consisting of only digits. A string of digits i...
find-minimum-time-to-reach-last-room-i
find-minimum-time-to-reach-last-room-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\nThere is a dungeon with n x m rooms arranged as a grid.\n\nYou are given a...
find-minimum-time-to-reach-last-room-ii
find-minimum-time-to-reach-last-room-ii__01__java
Graph
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nThere is a dungeon with n x m rooms arranged as a grid.\n\nYou are given a...
count-number-of-balanced-permutations
count-number-of-balanced-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\nYou are given a string num. A string of digits is called balanced if the s...
maximum-sized-array
maximum-sized-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\nGiven a positive integer s, let A be a 3D array of dimensions n × n ...
smallest-divisible-digit-product-i
smallest-divisible-digit-product-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 n and t. Return the smallest number greater tha...
maximum-frequency-of-an-element-after-performing-operations-i
maximum-frequency-of-an-element-after-performing-operations-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 an integer array nums and two integers k and numOperations.\...
maximum-frequency-of-an-element-after-performing-operations-ii
maximum-frequency-of-an-element-after-performing-operations-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 an integer array nums and two integers k and numOperations.\...
smallest-divisible-digit-product-ii
smallest-divisible-digit-product-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 num which represents a positive integer, and an int...
adjacent-increasing-subarrays-detection-i
adjacent-increasing-subarrays-detection-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\nGiven an array nums of n integers and an integer k, determine whether ther...
adjacent-increasing-subarrays-detection-ii
adjacent-increasing-subarrays-detection-ii__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\nGiven an array nums of n integers, your task is to find the maximum value ...
sum-of-good-subsequences
sum-of-good-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. A good subsequence is defined as a su...
count-k-reducible-numbers-less-than-n
count-k-reducible-numbers-less-than-n__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 binary string s representing a number n in its binary form...
minimum-total-operations
minimum-total-operations__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 an array of integers nums, you can perform any number of operations ...
make-array-elements-equal-to-zero
make-array-elements-equal-to-zero__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\nStart by selecting a starting posi...
zero-array-transformation-i
zero-array-transformation-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 and a 2D array queries, wh...
zero-array-transformation-ii
zero-array-transformation-ii__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 a 2D array queries whe...
minimize-the-maximum-adjacent-element-difference
minimize-the-maximum-adjacent-element-difference__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 integers nums. Some values in nums are missing a...
find-sorted-submatrices-with-maximum-element-at-most-k
find-sorted-submatrices-with-maximum-element-at-most-k__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 matrix grid of size m x n. You are also given a non-neg...
stone-removal-game
stone-removal-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 game where they take turns removing stones fro...
shift-distance-between-two-strings
shift-distance-between-two-strings__01__java
Array
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given two strings s and t of the same length, and two integer arra...
zero-array-transformation-iii
zero-array-transformation-iii__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 a 2D array queries whe...
find-the-maximum-number-of-fruits-collected
find-the-maximum-number-of-fruits-collected__01__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nThere is a game dungeon comprised of n x n rooms arranged in a grid.\n\nYo...
minimum-positive-sum-subarray
minimum-positive-sum-subarray__01__java
Sliding Window
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums and two integers l and r. Your task is...
rearrange-k-substrings-to-form-target-string
rearrange-k-substrings-to-form-target-string__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 strings s and t, both of which are anagrams of each othe...
minimum-array-sum
minimum-array-sum__01__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums and three integers k, op1, and op2.\n\...
maximize-sum-of-weights-after-edge-removals
maximize-sum-of-weights-after-edge-removals__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-an-array-statistics-tracker
design-an-array-statistics-tracker__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\nDesign a data structure that keeps track of the values in it and answers s...
smallest-number-with-all-set-bits
smallest-number-with-all-set-bits__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 positive number n.\n\nReturn the smallest number x greater...
identify-the-largest-outlier-in-an-array
identify-the-largest-outlier-in-an-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. This array contains n elements, where...
maximize-the-number-of-target-nodes-after-connecting-trees-i
maximize-the-number-of-target-nodes-after-connecting-trees-i__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, with distinct labels ...
maximize-the-number-of-target-nodes-after-connecting-trees-ii
maximize-the-number-of-target-nodes-after-connecting-trees-ii__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, labeled from [0, n - ...