slug
stringlengths
3
79
solution_id
stringlengths
13
89
primary_algorithm
stringclasses
22 values
verified
null
messages
listlengths
3
3
lexicographically-smallest-string-after-applying-operations
lexicographically-smallest-string-after-applying-operations__01__java
BFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a string s of even length consisting of digits from 0 to 9, ...
lexicographically-smallest-string-after-applying-operations
lexicographically-smallest-string-after-applying-operations__02__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 string s of even length consisting of digits from 0 to 9, ...
best-team-with-no-conflicts
best-team-with-no-conflicts__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 the manager of a basketball team. For the upcoming tournament, you...
best-team-with-no-conflicts
best-team-with-no-conflicts__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 the manager of a basketball team. For the upcoming tournament, you...
graph-connectivity-with-threshold
graph-connectivity-with-threshold__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\nWe have n cities labeled from 1 to n. Two different cities with labels x a...
design-an-expression-tree-with-evaluate-function
design-an-expression-tree-with-evaluate-function__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 the postfix tokens of an arithmetic expression, build and return the...
slowest-key
slowest-key__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 newly designed keypad was tested, where a tester pressed a sequence of n...
arithmetic-subarrays
arithmetic-subarrays__01__java
Sorting
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nA sequence of numbers is called arithmetic if it consists of at least two ...
path-with-minimum-effort
path-with-minimum-effort__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 a hiker preparing for an upcoming hike. You are given heights, a 2...
path-with-minimum-effort
path-with-minimum-effort__02__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 a hiker preparing for an upcoming hike. You are given heights, a 2...
path-with-minimum-effort
path-with-minimum-effort__03__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 a hiker preparing for an upcoming hike. You are given heights, a 2...
rank-transform-of-a-matrix
rank-transform-of-a-matrix__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\nGiven an m x n matrix, return a new matrix answer where answer[row][col] i...
add-two-polynomials-represented-as-linked-lists
add-two-polynomials-represented-as-linked-lists__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\nA polynomial linked list is a special type of linked list where every node...
sort-array-by-increasing-frequency
sort-array-by-increasing-frequency__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\nGiven an array of integers nums, sort the array in increasing order based ...
widest-vertical-area-between-two-points-containing-no-points
widest-vertical-area-between-two-points-containing-no-points__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\nGiven n points on a 2D plane where points[i] = [xi, yi], Return the widest...
widest-vertical-area-between-two-points-containing-no-points
widest-vertical-area-between-two-points-containing-no-points__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\nGiven n points on a 2D plane where points[i] = [xi, yi], Return the widest...
count-substrings-that-differ-by-one-character
count-substrings-that-differ-by-one-character__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 strings s and t, find the number of ways you can choose a non-em...
count-substrings-that-differ-by-one-character
count-substrings-that-differ-by-one-character__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 strings s and t, find the number of ways you can choose a non-em...
number-of-ways-to-form-a-target-string-given-a-dictionary
number-of-ways-to-form-a-target-string-given-a-dictionary__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 list of strings of the same length words and a string targ...
number-of-ways-to-form-a-target-string-given-a-dictionary
number-of-ways-to-form-a-target-string-given-a-dictionary__02__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a list of strings of the same length words and a string targ...
check-array-formation-through-concatenation
check-array-formation-through-concatenation__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 distinct integers arr and an array of integer ar...
check-array-formation-through-concatenation
check-array-formation-through-concatenation__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 of distinct integers arr and an array of integer ar...
count-sorted-vowel-strings
count-sorted-vowel-strings__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 integer n, return the number of strings of length n that consist ...
count-sorted-vowel-strings
count-sorted-vowel-strings__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 strings of length n that consist ...
furthest-building-you-can-reach
furthest-building-you-can-reach__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 heights representing the heights of buildin...
kth-smallest-instructions
kth-smallest-instructions__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\nBob is standing at cell (0, 0), and he wants to reach destination: (row, c...
lowest-common-ancestor-of-a-binary-tree-ii
lowest-common-ancestor-of-a-binary-tree-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\nGiven the root of a binary tree, return the lowest common ancestor (LCA) o...
get-maximum-in-generated-array
get-maximum-in-generated-array__01__java
Array
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer n. A 0-indexed integer array nums of length n + 1...
minimum-deletions-to-make-character-frequencies-unique
minimum-deletions-to-make-character-frequencies-unique__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\nA string s is called good if there are no two different characters in s th...
minimum-deletions-to-make-character-frequencies-unique
minimum-deletions-to-make-character-frequencies-unique__02__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\nA string s is called good if there are no two different characters in s th...
sell-diminishing-valued-colored-balls
sell-diminishing-valued-colored-balls__01__java
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou have an inventory of different colored balls, and there is a customer ...
create-sorted-array-through-instructions
create-sorted-array-through-instructions__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 integer array instructions, you are asked to create a sorted arra...
create-sorted-array-through-instructions
create-sorted-array-through-instructions__02__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 integer array instructions, you are asked to create a sorted arra...
lowest-common-ancestor-of-a-binary-tree-iii
lowest-common-ancestor-of-a-binary-tree-iii__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 two nodes of a binary tree p and q, return their lowest common ances...
lowest-common-ancestor-of-a-binary-tree-iii
lowest-common-ancestor-of-a-binary-tree-iii__02__java
Two Pointers
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven two nodes of a binary tree p and q, return their lowest common ances...
defuse-the-bomb
defuse-the-bomb__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 have a bomb to defuse, and your time is running out! Your informer wil...
defuse-the-bomb
defuse-the-bomb__02__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 have a bomb to defuse, and your time is running out! Your informer wil...
minimum-deletions-to-make-string-balanced
minimum-deletions-to-make-string-balanced__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 only of characters 'a' and 'b'​​​​.\n\...
minimum-deletions-to-make-string-balanced
minimum-deletions-to-make-string-balanced__02__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a string s consisting only of characters 'a' and 'b'​​​​.\n\...
minimum-jumps-to-reach-home
minimum-jumps-to-reach-home__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\nA certain bug's home is on the x-axis at position x. Help them get there f...
distribute-repeating-integers
distribute-repeating-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 an array of n integers, nums, where there are at most 50 uni...
design-an-ordered-stream
design-an-ordered-stream__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 stream of n (idKey, value) pairs arriving in an arbitrary order...
determine-if-two-strings-are-close
determine-if-two-strings-are-close__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\nTwo strings are considered close if you can attain one from the other usin...
minimum-operations-to-reduce-x-to-zero
minimum-operations-to-reduce-x-to-zero__01__java
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums and an integer x. In one operation, yo...
minimum-operations-to-reduce-x-to-zero
minimum-operations-to-reduce-x-to-zero__02__java
Two Pointers
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums and an integer x. In one operation, yo...
maximize-grid-happiness
maximize-grid-happiness__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 four integers, m, n, introvertsCount, and extrovertsCount. Y...
maximize-grid-happiness
maximize-grid-happiness__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 four integers, m, n, introvertsCount, and extrovertsCount. Y...
correct-a-binary-tree
correct-a-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 have a binary tree with a small defect. There is exactly one invalid n...
check-if-two-string-arrays-are-equivalent
check-if-two-string-arrays-are-equivalent__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 two string arrays word1 and word2, return true if the two arrays rep...
check-if-two-string-arrays-are-equivalent
check-if-two-string-arrays-are-equivalent__02__java
Array
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven two string arrays word1 and word2, return true if the two arrays rep...
smallest-string-with-a-given-numeric-value
smallest-string-with-a-given-numeric-value__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\nThe numeric value of a lowercase character is defined as its position (1-i...
ways-to-make-a-fair-array
ways-to-make-a-fair-array__01__java
Array
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums. You can choose exactly one index (0-i...
minimum-initial-energy-to-finish-tasks
minimum-initial-energy-to-finish-tasks__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 tasks where tasks[i] = [actuali, minimumi]:\n\n\tac...
change-the-root-of-a-binary-tree
change-the-root-of-a-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\nGiven the root of a binary tree and a leaf node, reroot the tree so that t...
maximum-repeating-substring
maximum-repeating-substring__01__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nFor a string sequence, a string word is k-repeating if word concatenated k...
merge-in-between-linked-lists
merge-in-between-linked-lists__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 linked lists: list1 and list2 of sizes n and m respectiv...
design-front-middle-back-queue
design-front-middle-back-queue__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\nDesign a queue that supports push and pop operations in the front, middle,...
minimum-number-of-removals-to-make-mountain-array
minimum-number-of-removals-to-make-mountain-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 may recall that an array arr is a mountain array if and only if:\n\n\t...
richest-customer-wealth
richest-customer-wealth__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 m x n integer grid accounts where accounts[i][j] is the a...
find-the-most-competitive-subsequence
find-the-most-competitive-subsequence__01__java
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums and a positive integer k, return the most comp...
minimum-moves-to-make-array-complementary
minimum-moves-to-make-array-complementary__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 n and an integer limit....
minimize-deviation-in-array
minimize-deviation-in-array__01__java
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an array nums of n positive integers.\n\nYou can perform two...
lowest-common-ancestor-of-a-binary-tree-iv
lowest-common-ancestor-of-a-binary-tree-iv__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\nGiven the root of a binary tree and an array of TreeNode objects nodes, re...
goal-parser-interpretation
goal-parser-interpretation__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 own a Goal Parser that can interpret a string command. The command con...
goal-parser-interpretation
goal-parser-interpretation__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 own a Goal Parser that can interpret a string command. The command con...
max-number-of-k-sum-pairs
max-number-of-k-sum-pairs__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 and an integer k.\n\nIn one operation,...
max-number-of-k-sum-pairs
max-number-of-k-sum-pairs__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 integer array nums and an integer k.\n\nIn one operation,...
concatenation-of-consecutive-binary-numbers
concatenation-of-consecutive-binary-numbers__01__java
Bit Manipulation
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven an integer n, return the decimal value of the binary string formed b...
concatenation-of-consecutive-binary-numbers
concatenation-of-consecutive-binary-numbers__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\nGiven an integer n, return the decimal value of the binary string formed b...
minimum-incompatibility
minimum-incompatibility__01__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums​​​ and an integer k. You are asked to ...
longest-palindromic-subsequence-ii
longest-palindromic-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\nA subsequence of a string s is considered a good palindromic subsequence i...
count-the-number-of-consistent-strings
count-the-number-of-consistent-strings__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 allowed consisting of distinct characters and an ar...
count-the-number-of-consistent-strings
count-the-number-of-consistent-strings__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\nYou are given a string allowed consisting of distinct characters and an ar...
sum-of-absolute-differences-in-a-sorted-array
sum-of-absolute-differences-in-a-sorted-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 sorted in non-decreasing order.\n\nBui...
stone-game-vi
stone-game-vi__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\nAlice and Bob take turns playing a game, with Alice starting first.\n\nThe...
delivering-boxes-from-storage-to-ports
delivering-boxes-from-storage-to-ports__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 the task of delivering some boxes from storage to their ports usi...
count-of-matches-in-tournament
count-of-matches-in-tournament__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, the number of teams in a tournament that has s...
partitioning-into-minimum-number-of-deci-binary-numbers
partitioning-into-minimum-number-of-deci-binary-numbers__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\nA decimal number is called deci-binary if each of its digits is either 0 o...
stone-game-vii
stone-game-vii__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 and Bob take turns playing a game, with Alice starting first.\n\nThe...
stone-game-vii
stone-game-vii__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\nAlice and Bob take turns playing a game, with Alice starting first.\n\nThe...
maximum-height-by-stacking-cuboids
maximum-height-by-stacking-cuboids__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 n cuboids where the dimensions of the ith cuboid is cuboids[i] = [wi...
count-ways-to-distribute-candies
count-ways-to-distribute-candies__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 are n unique candies (labeled 1 through n) and k bags. You are asked...
reformat-phone-number
reformat-phone-number__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 phone number as a string number. number consists of digits...
maximum-erasure-value
maximum-erasure-value__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 and want to erase a subar...
maximum-erasure-value
maximum-erasure-value__02__java
Two Pointers
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an array of positive integers nums and want to erase a subar...
jump-game-vi
jump-game-vi__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 and an integer k.\n\nYou are ...
checking-existence-of-edge-length-limited-paths
checking-existence-of-edge-length-limited-paths__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\nAn undirected graph of n nodes is defined by edgeList, where edgeList[i] =...
number-of-distinct-substrings-in-a-string
number-of-distinct-substrings-in-a-string__01__java
Brute Force
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven a string s, return the number of distinct substrings of s.\n\nA subs...
number-of-distinct-substrings-in-a-string
number-of-distinct-substrings-in-a-string__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\nGiven a string s, return the number of distinct substrings of s.\n\nA subs...
number-of-students-unable-to-eat-lunch
number-of-students-unable-to-eat-lunch__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\nThe school cafeteria offers circular and square sandwiches at lunch break,...
average-waiting-time
average-waiting-time__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nThere is a restaurant with a single chef. You are given an array customers...
maximum-binary-string-after-change
maximum-binary-string-after-change__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 binary consisting of only 0's or 1's. You ca...
minimum-adjacent-swaps-for-k-consecutive-ones
minimum-adjacent-swaps-for-k-consecutive-ones__01__java
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array, nums, and an integer k. nums comprises of ...
determine-if-string-halves-are-alike
determine-if-string-halves-are-alike__01__java
String
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a string s of even length. Split this string into two halves...
maximum-number-of-eaten-apples
maximum-number-of-eaten-apples__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 a special kind of apple tree that grows apples every day for n da...
where-will-the-ball-fall
where-will-the-ball-fall__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 have a 2-D grid of size m x n representing a box, and you have n balls...
maximum-xor-with-an-element-from-array
maximum-xor-with-an-element-from-array__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 an array nums consisting of non-negative integers. You are a...
largest-subarray-length-k
largest-subarray-length-k__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\nAn array A is larger than some array B if for the first index i where A[i]...
maximum-units-on-a-truck
maximum-units-on-a-truck__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 assigned to put some amount of boxes onto one truck. You are given...
maximum-units-on-a-truck
maximum-units-on-a-truck__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 assigned to put some amount of boxes onto one truck. You are given...