slug
stringlengths
3
79
solution_id
stringlengths
13
89
primary_algorithm
stringclasses
22 values
verified
null
messages
listlengths
3
3
connecting-cities-with-minimum-cost
connecting-cities-with-minimum-cost__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 are n cities labeled from 1 to n. You are given the integer n and an...
parallel-courses
parallel-courses__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 n, which indicates that there are n courses label...
n-th-tribonacci-number
n-th-tribonacci-number__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\nThe Tribonacci sequence Tn is defined as follows: \n\nT0 = 0, T1 = 1, T2 =...
n-th-tribonacci-number
n-th-tribonacci-number__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\nThe Tribonacci sequence Tn is defined as follows: \n\nT0 = 0, T1 = 1, T2 =...
alphabet-board-path
alphabet-board-path__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\nOn an alphabet board, we start at position (0, 0), corresponding to charac...
largest-1-bordered-square
largest-1-bordered-square__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 a 2D grid of 0s and 1s, return the number of elements in the largest...
stone-game-ii
stone-game-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\nAlice and Bob continue their games with piles of stones. There are a numbe...
longest-common-subsequence
longest-common-subsequence__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 text1 and text2, return the length of their longest comm...
decrease-elements-to-make-array-zigzag
decrease-elements-to-make-array-zigzag__01__java
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven an array nums of integers, a move consists of choosing any element a...
binary-tree-coloring-game
binary-tree-coloring-game__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\nTwo players play a turn based game on a binary tree. We are given the root...
snapshot-array
snapshot-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\nImplement a SnapshotArray that supports the following interface:\n\n\tSnap...
longest-chunked-palindrome-decomposition
longest-chunked-palindrome-decomposition__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 text. You should split it to k substrings (subtext1...
longest-chunked-palindrome-decomposition
longest-chunked-palindrome-decomposition__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 text. You should split it to k substrings (subtext1...
check-if-a-number-is-majority-element-in-a-sorted-array
check-if-a-number-is-majority-element-in-a-sorted-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 an integer array nums sorted in non-decreasing order and an integer ...
check-if-a-number-is-majority-element-in-a-sorted-array
check-if-a-number-is-majority-element-in-a-sorted-array__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 nums sorted in non-decreasing order and an integer ...
minimum-swaps-to-group-all-1s-together
minimum-swaps-to-group-all-1s-together__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 binary array data, return the minimum number of swaps required to ...
analyze-user-website-visit-pattern
analyze-user-website-visit-pattern__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 two string arrays username and website and an integer array ...
string-transforms-into-another-string
string-transforms-into-another-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\nGiven two strings str1 and str2 of the same length, determine whether you ...
day-of-the-year
day-of-the-year__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven a string date representing a Gregorian calendar date formatted as YY...
number-of-dice-rolls-with-target-sum
number-of-dice-rolls-with-target-sum__01__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou have n dice, and each dice has k faces numbered from 1 to k.\n\nGiven ...
number-of-dice-rolls-with-target-sum
number-of-dice-rolls-with-target-sum__02__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou have n dice, and each dice has k faces numbered from 1 to k.\n\nGiven ...
swap-for-longest-repeated-character-substring
swap-for-longest-repeated-character-substring__01__java
Two Pointers
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a string text. You can swap two of the characters in the tex...
online-majority-element-in-subarray
online-majority-element-in-subarray__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\nDesign a data structure that efficiently finds the majority element of a g...
find-words-that-can-be-formed-by-characters
find-words-that-can-be-formed-by-characters__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 words and a string chars.\n\nA string is...
maximum-level-sum-of-a-binary-tree
maximum-level-sum-of-a-binary-tree__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\nGiven the root of a binary tree, the level of its root is 1, the level of ...
maximum-level-sum-of-a-binary-tree
maximum-level-sum-of-a-binary-tree__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\nGiven the root of a binary tree, the level of its root is 1, the level of ...
as-far-from-land-as-possible
as-far-from-land-as-possible__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\nGiven an n x n grid containing only values 0 and 1, where 0 represents wat...
last-substring-in-lexicographical-order
last-substring-in-lexicographical-order__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\nGiven a string s, return the last substring of s in lexicographical order....
single-row-keyboard
single-row-keyboard__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 special keyboard with all keys in a single row.\n\nGiven a stri...
design-file-system
design-file-system__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 asked to design a file system that allows you to create new paths ...
minimum-cost-to-connect-sticks
minimum-cost-to-connect-sticks__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 some number of sticks with positive integer lengths. These length...
optimize-water-distribution-in-a-village
optimize-water-distribution-in-a-village__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 are n houses in a village. We want to supply water for all the house...
optimize-water-distribution-in-a-village
optimize-water-distribution-in-a-village__02__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 are n houses in a village. We want to supply water for all the house...
invalid-transactions
invalid-transactions__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\nA transaction is possibly invalid if:\n\n\tthe amount exceeds $1000, or;\n...
compare-strings-by-frequency-of-the-smallest-character
compare-strings-by-frequency-of-the-smallest-character__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\nLet the function f(s) be the frequency of the lexicographically smallest c...
remove-zero-sum-consecutive-nodes-from-linked-list
remove-zero-sum-consecutive-nodes-from-linked-list__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 the head of a linked list, we repeatedly delete consecutive sequence...
dinner-plate-stacks
dinner-plate-stacks__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 have an infinite number of stacks arranged in a row and numbered (left...
prime-arrangements
prime-arrangements__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\nReturn the number of permutations of 1 to n so that prime numbers are at p...
diet-plan-performance
diet-plan-performance__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\nA dieter consumes calories[i] calories on the i-th day. \n\nGiven an integ...
diet-plan-performance
diet-plan-performance__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\nA dieter consumes calories[i] calories on the i-th day. \n\nGiven an integ...
can-make-palindrome-from-substring
can-make-palindrome-from-substring__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 string s and array queries where queries[i] = [lefti, righ...
number-of-valid-words-for-each-puzzle
number-of-valid-words-for-each-puzzle__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\nWith respect to a given puzzle string, a word is valid if both the followi...
count-substrings-with-only-one-distinct-letter
count-substrings-with-only-one-distinct-letter__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\nGiven a string s, return the number of substrings that have only one disti...
count-substrings-with-only-one-distinct-letter
count-substrings-with-only-one-distinct-letter__02__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven a string s, return the number of substrings that have only one disti...
before-and-after-puzzle
before-and-after-puzzle__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 a list of phrases, generate a list of Before and After puzzles.\n\nA...
shortest-distance-to-target-color
shortest-distance-to-target-color__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 colors, in which there are three colors: 1, 2 and 3...
maximum-number-of-ones
maximum-number-of-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\nConsider a matrix M with dimensions width * height, such that every cell h...
distance-between-bus-stops
distance-between-bus-stops__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\nA bus has n stops numbered from 0 to n - 1 that form a circle. We know the...
day-of-the-week
day-of-the-week__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 date, return the corresponding day of the week for that date.\n\nT...
day-of-the-week
day-of-the-week__02__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven a date, return the corresponding day of the week for that date.\n\nT...
maximum-subarray-sum-with-one-deletion
maximum-subarray-sum-with-one-deletion__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, return the maximum sum for a non-empty subarra...
make-array-strictly-increasing
make-array-strictly-increasing__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 integer arrays arr1 and arr2, return the minimum number of opera...
design-bounded-blocking-queue
design-bounded-blocking-queue__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\nImplement a thread-safe bounded blocking queue that has the following meth...
maximum-number-of-balloons
maximum-number-of-balloons__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 string text, you want to use the characters of text to form as man...
reverse-substrings-between-each-pair-of-parentheses
reverse-substrings-between-each-pair-of-parentheses__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 that consists of lower case English letters and b...
reverse-substrings-between-each-pair-of-parentheses
reverse-substrings-between-each-pair-of-parentheses__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 string s that consists of lower case English letters and b...
k-concatenation-maximum-sum
k-concatenation-maximum-sum__01__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven an integer array arr and an integer k, modify the array by repeating...
critical-connections-in-a-network
critical-connections-in-a-network__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 are n servers numbered from 0 to n - 1 connected by undirected serve...
fizz-buzz-multithreaded
fizz-buzz-multithreaded__01__java
Brute Force
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou have the four functions:\n\n\tprintFizz that prints the word \"fizz\" ...
how-many-apples-can-you-put-into-the-basket
how-many-apples-can-you-put-into-the-basket__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 some apples and a basket that can carry up to 5000 units of weigh...
minimum-knight-moves
minimum-knight-moves__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\nIn an infinite chess board with coordinates from -infinity to +infinity, y...
minimum-knight-moves
minimum-knight-moves__02__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\nIn an infinite chess board with coordinates from -infinity to +infinity, y...
find-smallest-common-element-in-all-rows
find-smallest-common-element-in-all-rows__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 m x n matrix mat where every row is sorted in strictly increasing...
minimum-time-to-build-blocks
minimum-time-to-build-blocks__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 list of blocks, where blocks[i] = t means that the i-th bl...
minimum-absolute-difference
minimum-absolute-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\nGiven an array of distinct integers arr, find all pairs of elements with t...
ugly-number-iii
ugly-number-iii__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\nAn ugly number is a positive integer that is divisible by a, b, or c.\n\nG...
smallest-string-with-swaps
smallest-string-with-swaps__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 string s, and an array of pairs of indices in the string p...
sort-items-by-groups-respecting-dependencies
sort-items-by-groups-respecting-dependencies__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 are n items each belonging to zero or one of m groups where group[i]...
design-skiplist
design-skiplist__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 Skiplist without using any built-in libraries.\n\nA skiplist is a...
unique-number-of-occurrences
unique-number-of-occurrences__01__java
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven an array of integers arr, return true if the number of occurrences o...
get-equal-substrings-within-budget
get-equal-substrings-within-budget__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 strings s and t of the same length and an integer maxCos...
get-equal-substrings-within-budget
get-equal-substrings-within-budget__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 two strings s and t of the same length and an integer maxCos...
get-equal-substrings-within-budget
get-equal-substrings-within-budget__03__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 two strings s and t of the same length and an integer maxCos...
remove-all-adjacent-duplicates-in-string-ii
remove-all-adjacent-duplicates-in-string-ii__01__java
String
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a string s and an integer k, a k duplicate removal consists ...
minimum-moves-to-reach-target-with-rotations
minimum-moves-to-reach-target-with-rotations__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\nIn an n*n grid, there is a snake that spans 2 cells and starts moving from...
intersection-of-three-sorted-arrays
intersection-of-three-sorted-arrays__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 three integer arrays arr1, arr2 and arr3 sorted in strictly increasi...
intersection-of-three-sorted-arrays
intersection-of-three-sorted-arrays__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 three integer arrays arr1, arr2 and arr3 sorted in strictly increasi...
two-sum-bsts
two-sum-bsts__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\nGiven the roots of two binary search trees, root1 and root2, return true i...
stepping-numbers
stepping-numbers__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 stepping number is an integer such that all of its adjacent digits have ...
valid-palindrome-iii
valid-palindrome-iii__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 a string s and an integer k, return true if s is a k-palindrome.\n\n...
minimum-cost-to-move-chips-to-the-same-position
minimum-cost-to-move-chips-to-the-same-position__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\nWe have n chips, where the position of the ith chip is position[i].\n\nWe ...
longest-arithmetic-subsequence-of-given-difference
longest-arithmetic-subsequence-of-given-difference__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 array arr and an integer difference, return the length of...
path-with-maximum-gold
path-with-maximum-gold__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\nIn a gold mine grid of size m x n, each cell in this mine has an integer r...
count-vowels-permutation
count-vowels-permutation__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, your task is to count how many strings of length n can...
count-vowels-permutation
count-vowels-permutation__02__java
Recursion
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven an integer n, your task is to count how many strings of length n can...
split-a-string-in-balanced-strings
split-a-string-in-balanced-strings__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\nBalanced strings are those that have an equal quantity of 'L' and 'R' char...
queens-that-can-attack-the-king
queens-that-can-attack-the-king__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\nOn a 0-indexed 8 x 8 chessboard, there can be multiple black queens and on...
dice-roll-simulation
dice-roll-simulation__01__java
Memoization
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nA die simulator generates a random number from 1 to 6 for each roll. You i...
dice-roll-simulation
dice-roll-simulation__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\nA die simulator generates a random number from 1 to 6 for each roll. You i...
maximum-equal-frequency
maximum-equal-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\nGiven an array nums of positive integers, return the longest possible leng...
airplane-seat-assignment-probability
airplane-seat-assignment-probability__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\nn passengers board an airplane with exactly n seats. The first passenger h...
missing-number-in-arithmetic-progression
missing-number-in-arithmetic-progression__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 some array arr, the values were in arithmetic progression: the values a...
missing-number-in-arithmetic-progression
missing-number-in-arithmetic-progression__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\nIn some array arr, the values were in arithmetic progression: the values a...
meeting-scheduler
meeting-scheduler__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\nGiven the availability time slots arrays slots1 and slots2 of two people a...
toss-strange-coins
toss-strange-coins__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 some coins. The i-th coin has a probability prob[i] of facing he...
toss-strange-coins
toss-strange-coins__02__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou have some coins. The i-th coin has a probability prob[i] of facing he...
divide-chocolate
divide-chocolate__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 one chocolate bar that consists of some chunks. Each chunk has it...
check-if-it-is-a-straight-line
check-if-it-is-a-straight-line__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 coordinates, coordinates[i] = [x, y], where...
remove-sub-folders-from-the-filesystem
remove-sub-folders-from-the-filesystem__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 a list of folders folder, return the folders after removing all sub-...
remove-sub-folders-from-the-filesystem
remove-sub-folders-from-the-filesystem__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 list of folders folder, return the folders after removing all sub-...