slug
stringlengths
3
79
solution_id
stringlengths
13
89
primary_algorithm
stringclasses
22 values
verified
null
messages
listlengths
3
3
maximize-number-of-subsequences-in-a-string
maximize-number-of-subsequences-in-a-string__01__java
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed string text and another 0-indexed string pattern...
minimum-operations-to-halve-array-sum
minimum-operations-to-halve-array-sum__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 positive integers. In one operation, you ca...
minimum-white-tiles-after-covering-with-carpets
minimum-white-tiles-after-covering-with-carpets__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 0-indexed binary string floor, which represents the colors...
count-hills-and-valleys-in-an-array
count-hills-and-valleys-in-an-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 a 0-indexed integer array nums. An index i is part of a hill...
count-collisions-on-a-road
count-collisions-on-a-road__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\nThere are n cars on an infinitely long road. The cars are numbered from 0 ...
maximum-points-in-an-archery-competition
maximum-points-in-an-archery-competition__01__java
Backtracking
null
[ { "role": "system", "content": "You 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 opponents in an archery competition. The competition has...
longest-substring-of-one-repeating-character
longest-substring-of-one-repeating-character__01__java
Array
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed string s. You are also given a 0-indexed string ...
minimum-health-to-beat-game
minimum-health-to-beat-game__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 playing a game that has n levels numbered from 0 to n - 1. You are...
find-the-difference-of-two-arrays
find-the-difference-of-two-arrays__01__java
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven two 0-indexed integer arrays nums1 and nums2, return a list answer o...
minimum-deletions-to-make-array-beautiful
minimum-deletions-to-make-array-beautiful__01__java
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array nums. The array nums is beautiful ...
minimum-deletions-to-make-array-beautiful
minimum-deletions-to-make-array-beautiful__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\nYou are given a 0-indexed integer array nums. The array nums is beautiful ...
find-palindrome-with-fixed-length
find-palindrome-with-fixed-length__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 an integer array queries and a positive integer intLength, return an...
maximum-value-of-k-coins-from-piles
maximum-value-of-k-coins-from-piles__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 piles of coins on a table. Each pile consists of a positive nu...
maximum-value-of-k-coins-from-piles
maximum-value-of-k-coins-from-piles__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\nThere are n piles of coins on a table. Each pile consists of a positive nu...
maximum-sum-score-of-array
maximum-sum-score-of-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 a 0-indexed integer array nums of length n.\n\nThe sum score...
minimum-bit-flips-to-convert-number
minimum-bit-flips-to-convert-number__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\nA bit flip of a number x is choosing a bit in the binary representation of...
find-triangular-sum-of-an-array
find-triangular-sum-of-an-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 a 0-indexed integer array nums, where nums[i] is a digit bet...
number-of-ways-to-select-buildings
number-of-ways-to-select-buildings__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 binary string s which represents the types of bu...
sum-of-scores-of-built-strings
sum-of-scores-of-built-strings__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 building a string s of length n one character at a time, prependin...
minimum-number-of-operations-to-convert-time
minimum-number-of-operations-to-convert-time__01__java
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given two strings current and correct representing two 24-hour tim...
find-players-with-zero-or-one-losses
find-players-with-zero-or-one-losses__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 matches where matches[i] = [winneri, loseri...
maximum-candies-allocated-to-k-children
maximum-candies-allocated-to-k-children__01__java
Binary Search
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array candies. Each element in the array...
encrypt-and-decrypt-strings
encrypt-and-decrypt-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 character array keys containing unique characters and a st...
check-if-an-array-is-consecutive
check-if-an-array-is-consecutive__01__java
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums, return true if nums is consecutive, otherwise...
largest-number-after-digit-swaps-by-parity
largest-number-after-digit-swaps-by-parity__01__java
Sorting
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a positive integer num. You may swap any two digits of num t...
minimize-result-by-adding-parentheses-to-expression
minimize-result-by-adding-parentheses-to-expression__01__java
String
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed string expression of the form \"<num1>+<num2>\" ...
maximum-product-after-k-increments
maximum-product-after-k-increments__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 non-negative integers nums and an integer k. In ...
maximum-total-beauty-of-the-gardens
maximum-total-beauty-of-the-gardens__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\nAlice is a caretaker of n gardens and she wants to plant flowers to maximi...
add-two-integers
add-two-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\nGiven two integers num1 and num2, return the sum of the two integers.\n\n#...
add-two-integers
add-two-integers__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 two integers num1 and num2, return the sum of the two integers.\n\n#...
root-equals-sum-of-children
root-equals-sum-of-children__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 are given the root of a binary tree that consists of exactly 3 nodes: ...
count-positions-on-street-with-required-brightness
count-positions-on-street-with-required-brightness__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 perfectly straight street is represented by ...
find-closest-number-to-zero
find-closest-number-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\nGiven an integer array nums of size n, return the number with the value cl...
number-of-ways-to-buy-pens-and-pencils
number-of-ways-to-buy-pens-and-pencils__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 total indicating the amount of money you have. Yo...
design-an-atm-machine
design-an-atm-machine__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 an ATM machine that stores banknotes of 5 denominations: 20, 50, ...
maximum-score-of-a-node-sequence
maximum-score-of-a-node-sequence__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 an undirected graph with n nodes, numbered from 0 to n - 1.\n\nYo...
calculate-digit-sum-of-a-string
calculate-digit-sum-of-a-string__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a string s consisting of digits and an integer k.\n\nA round...
minimum-rounds-to-complete-all-tasks
minimum-rounds-to-complete-all-tasks__01__java
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array tasks, where tasks[i] represents t...
maximum-trailing-zeros-in-a-cornered-path
maximum-trailing-zeros-in-a-cornered-path__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 are given a 2D integer array grid of size m x n, where each cell conta...
longest-path-with-different-adjacent-characters
longest-path-with-different-adjacent-characters__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 (i.e. a connected, undirected graph that has no cycle...
maximum-cost-of-trip-with-k-highways
maximum-cost-of-trip-with-k-highways__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 series of highways connect n cities numbered from 0 to n - 1. You are gi...
intersection-of-multiple-arrays
intersection-of-multiple-arrays__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 2D integer array nums where nums[i] is a non-empty array of distin...
intersection-of-multiple-arrays
intersection-of-multiple-arrays__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 a 2D integer array nums where nums[i] is a non-empty array of distin...
count-lattice-points-inside-a-circle
count-lattice-points-inside-a-circle__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 2D integer array circles where circles[i] = [xi, yi, ri] represent...
count-number-of-rectangles-containing-each-point
count-number-of-rectangles-containing-each-point__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 integer array rectangles where rectangles[i] = [li, hi]...
number-of-flowers-in-full-bloom
number-of-flowers-in-full-bloom__01__java
Binary Search
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed 2D integer array flowers, where flowers[i] = [st...
number-of-flowers-in-full-bloom
number-of-flowers-in-full-bloom__02__java
Sorting
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed 2D integer array flowers, where flowers[i] = [st...
design-video-sharing-platform
design-video-sharing-platform__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 a video sharing platform where users can upload and delete videos...
count-prefixes-of-a-given-string
count-prefixes-of-a-given-string__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 string array words and a string s, where words[i] and s co...
minimum-average-difference
minimum-average-difference__01__java
Array
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array nums of length n.\n\nThe average d...
count-unguarded-cells-in-the-grid
count-unguarded-cells-in-the-grid__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 m and n representing a 0-indexed m x n grid. Yo...
escape-the-spreading-fire
escape-the-spreading-fire__01__java
Binary Search
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed 2D integer array grid of size m x n which repres...
remove-digit-from-number-to-maximize-result
remove-digit-from-number-to-maximize-result__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 are given a string number representing a positive integer and a charac...
remove-digit-from-number-to-maximize-result
remove-digit-from-number-to-maximize-result__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\nYou are given a string number representing a positive integer and a charac...
minimum-consecutive-cards-to-pick-up
minimum-consecutive-cards-to-pick-up__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 cards where cards[i] represents the value o...
k-divisible-elements-subarrays
k-divisible-elements-subarrays__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\nGiven an integer array nums and two integers k and p, return the number of...
total-appeal-of-a-string
total-appeal-of-a-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\nThe appeal of a string is the number of distinct characters found in the s...
make-array-non-decreasing-or-non-increasing
make-array-non-decreasing-or-non-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\nYou are given a 0-indexed integer array nums. In one operation, you can:\n...
largest-3-same-digit-number-in-string
largest-3-same-digit-number-in-string__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 num representing a large integer. An integer is goo...
count-nodes-equal-to-average-of-subtree
count-nodes-equal-to-average-of-subtree__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 number of nodes where the valu...
count-number-of-texts
count-number-of-texts__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 texting Bob using her phone. The mapping of digits to letters is ...
check-if-there-is-a-valid-parentheses-string-path
check-if-there-is-a-valid-parentheses-string-path__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\nA parentheses string is a non-empty string consisting only of '(' and ')'....
minimum-number-of-keypresses
minimum-number-of-keypresses__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 a keypad with 9 buttons, numbered from 1 to 9, each mapped to low...
find-the-k-beauty-of-a-number
find-the-k-beauty-of-a-number__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\nThe k-beauty of an integer num is defined as the number of substrings of n...
find-the-k-beauty-of-a-number
find-the-k-beauty-of-a-number__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\nThe k-beauty of an integer num is defined as the number of substrings of n...
number-of-ways-to-split-array
number-of-ways-to-split-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 a 0-indexed integer array nums of length n.\n\nnums contains...
maximum-white-tiles-covered-by-a-carpet
maximum-white-tiles-covered-by-a-carpet__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 2D integer array tiles where tiles[i] = [li, ri] represent...
substring-with-largest-variance
substring-with-largest-variance__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 variance of a string is defined as the largest difference between the ...
find-resultant-array-after-removing-anagrams
find-resultant-array-after-removing-anagrams__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed string array words, where words[i] consists of l...
maximum-consecutive-floors-without-special-floors
maximum-consecutive-floors-without-special-floors__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\nAlice manages a company and has rented some floors of a building as office...
largest-combination-with-bitwise-and-greater-than-zero
largest-combination-with-bitwise-and-greater-than-zero__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\nThe bitwise AND of an array nums is the bitwise AND of all integers in num...
count-integers-in-intervals
count-integers-in-intervals__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 an empty set of intervals, implement a data structure that can:\n\n\...
closest-node-to-path-in-tree
closest-node-to-path-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\nYou are given a positive integer n representing the number of nodes in a t...
percentage-of-letter-in-string
percentage-of-letter-in-string__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\nGiven a string s and a character letter, return the percentage of characte...
maximum-bags-with-full-capacity-of-rocks
maximum-bags-with-full-capacity-of-rocks__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 n bags numbered from 0 to n - 1. You are given two 0-indexed inte...
minimum-lines-to-represent-a-line-chart
minimum-lines-to-represent-a-line-chart__01__java
Sorting
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 2D integer array stockPrices where stockPrices[i] = [dayi,...
sum-of-total-strength-of-wizards
sum-of-total-strength-of-wizards__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\nAs the ruler of a kingdom, you have an army of wizards at your command.\n\...
number-of-people-that-can-be-seen-in-a-grid
number-of-people-that-can-be-seen-in-a-grid__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 0-indexed 2D array of positive integers heights whe...
check-if-number-has-equal-digit-count-and-digit-value
check-if-number-has-equal-digit-count-and-digit-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 a 0-indexed string num of length n consisting of digits.\n\n...
sender-with-largest-word-count
sender-with-largest-word-count__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 have a chat log of n messages. You are given two string arrays message...
maximum-total-importance-of-roads
maximum-total-importance-of-roads__01__java
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer n denoting the number of cities in a country. The...
booking-concert-tickets-in-groups
booking-concert-tickets-in-groups__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\nA concert hall has n rows numbered from 0 to n - 1, each with m seats, num...
rearrange-characters-to-make-target-string
rearrange-characters-to-make-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 0-indexed strings s and target. You can take some letter...
apply-discount-to-prices
apply-discount-to-prices__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 sentence is a string of single-space separated words where each word can...
steps-to-make-array-non-decreasing
steps-to-make-array-non-decreasing__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. In one step, remove all elem...
minimum-obstacle-removal-to-reach-corner
minimum-obstacle-removal-to-reach-corner__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 0-indexed 2D integer array grid of size m x n. Each cell h...
maximum-profit-from-trading-stocks
maximum-profit-from-trading-stocks__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 0-indexed integer arrays of the same length present and ...
maximum-profit-from-trading-stocks
maximum-profit-from-trading-stocks__02__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given two 0-indexed integer arrays of the same length present and ...
min-max-game
min-max-game__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array nums whose length is a power of 2....
partition-array-such-that-maximum-difference-is-k
partition-array-such-that-maximum-difference-is-k__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. You may partition nu...
replace-elements-in-an-array
replace-elements-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 a 0-indexed array nums that consists of n distinct positive ...
design-a-text-editor
design-a-text-editor__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 text editor with a cursor that can do the following:\n\n\tAdd tex...
jump-game-viii
jump-game-viii__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 of length n. You are initiall...
strong-password-checker-ii
strong-password-checker-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\nA password is said to be strong if it satisfies all the following criteria...
successful-pairs-of-spells-and-potions
successful-pairs-of-spells-and-potions__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 positive integer arrays spells and potions, of length n ...
match-substring-after-replacement
match-substring-after-replacement__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 sub. You are also given a 2D character arr...
match-substring-after-replacement
match-substring-after-replacement__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 two strings s and sub. You are also given a 2D character arr...
count-subarrays-with-score-less-than-k
count-subarrays-with-score-less-than-k__01__java
Binary Search
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nThe score of an array is defined as the product of its sum and its length....
count-subarrays-with-score-less-than-k
count-subarrays-with-score-less-than-k__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\nThe score of an array is defined as the product of its sum and its length....
calculate-amount-paid-in-taxes
calculate-amount-paid-in-taxes__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed 2D integer array brackets where brackets[i] = [u...