slug
stringlengths
3
79
solution_id
stringlengths
13
89
primary_algorithm
stringclasses
22 values
verified
null
messages
listlengths
3
3
divide-players-into-teams-of-equal-skill
divide-players-into-teams-of-equal-skill__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 a positive integer array skill of even length n where skill[...
minimum-score-of-a-path-between-two-cities
minimum-score-of-a-path-between-two-cities__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 n cities numbered from 1 t...
minimum-score-of-a-path-between-two-cities
minimum-score-of-a-path-between-two-cities__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\nYou are given a positive integer n representing n cities numbered from 1 t...
divide-nodes-into-the-maximum-number-of-groups
divide-nodes-into-the-maximum-number-of-groups__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 positive integer n representing the number of nodes in an ...
number-of-subarrays-having-even-product
number-of-subarrays-having-even-product__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 0-indexed integer array nums, return the number of subarrays of nu...
maximum-value-of-a-string-in-an-array
maximum-value-of-a-string-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\nThe value of an alphanumeric string can be defined as:\n\n\tThe numeric re...
maximum-star-sum-of-a-graph
maximum-star-sum-of-a-graph__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 an undirected graph consisting of n nodes numbered from 0 to n - ...
frog-jump-ii
frog-jump-ii__01__java
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array stones sorted in strictly increasi...
minimum-total-cost-to-make-arrays-unequal
minimum-total-cost-to-make-arrays-unequal__01__java
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given two 0-indexed integer arrays nums1 and nums2, of equal lengt...
delete-greatest-value-in-each-row
delete-greatest-value-in-each-row__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 m x n matrix grid consisting of positive integers.\n\nPer...
longest-square-streak-in-an-array
longest-square-streak-in-an-array__01__java
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums. A subsequence of nums is called a squ...
longest-square-streak-in-an-array
longest-square-streak-in-an-array__02__java
Memoization
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums. A subsequence of nums is called a squ...
design-memory-allocator
design-memory-allocator__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 representing the size of a 0-indexed memory arr...
design-memory-allocator
design-memory-allocator__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 n representing the size of a 0-indexed memory arr...
maximum-number-of-points-from-grid-queries
maximum-number-of-points-from-grid-queries__01__java
BFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an m x n integer matrix grid and an array queries of size k....
bitwise-or-of-all-subsequence-sums
bitwise-or-of-all-subsequence-sums__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 array nums, return the value of the bitwise OR of the sum...
count-pairs-of-similar-strings
count-pairs-of-similar-strings__01__java
Bit Manipulation
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed string array words.\n\nTwo strings are similar i...
smallest-value-after-replacing-with-sum-of-prime-factors
smallest-value-after-replacing-with-sum-of-prime-factors__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 positive integer n.\n\nContinuously replace n with the sum...
add-edges-to-make-degrees-of-all-nodes-even
add-edges-to-make-degrees-of-all-nodes-even__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 consisting of n nodes numbered from 1 to n. Y...
cycle-length-queries-in-a-tree
cycle-length-queries-in-a-tree__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. There is a complete binary tree with 2n - 1 no...
check-if-there-is-a-path-with-equal-number-of-0s-and-1s
check-if-there-is-a-path-with-equal-number-of-0s-and-1s__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 m x n binary matrix grid. You can move from a ce...
maximum-enemy-forts-that-can-be-captured
maximum-enemy-forts-that-can-be-captured__01__java
Two Pointers
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array forts of length n representing the...
reward-top-k-students
reward-top-k-students__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 positive_feedback and negative_feedback, c...
minimize-the-maximum-of-two-arrays
minimize-the-maximum-of-two-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\nWe have two arrays arr1 and arr2 which are initially empty. You need to ad...
count-anagrams
count-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 string s containing one or more words. Every consecutive p...
shortest-distance-to-target-string-in-a-circular-array
shortest-distance-to-target-string-in-a-circular-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 circular string array words and a string target....
take-k-of-each-character-from-left-and-right
take-k-of-each-character-from-left-and-right__01__java
Sliding Window
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a string s consisting of the characters 'a', 'b', and 'c' an...
maximum-tastiness-of-candy-basket
maximum-tastiness-of-candy-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 are given an array of positive integers price where price[i] denotes t...
number-of-great-partitions
number-of-great-partitions__01__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an array nums consisting of positive integers and an integer...
count-the-number-of-k-big-indices
count-the-number-of-k-big-indices__01__java
Binary Search
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array nums and a positive integer k.\n\n...
count-the-digits-that-divide-a-number
count-the-digits-that-divide-a-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\nGiven an integer num, return the number of digits in num that divide num.\...
distinct-prime-factors-of-product-of-array
distinct-prime-factors-of-product-of-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\nGiven an array of positive integers nums, return the number of distinct pr...
partition-string-into-substrings-with-values-at-most-k
partition-string-into-substrings-with-values-at-most-k__01__java
Memoization
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a string s consisting of digits from 1 to 9 and an integer k...
closest-prime-numbers-in-range
closest-prime-numbers-in-range__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 positive integers left and right, find the two integers num1 and...
maximum-frequency-score-of-a-subarray
maximum-frequency-score-of-a-subarray__01__java
Sliding Window
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums and a positive integer k.\n\nThe frequ...
categorize-box-according-to-criteria
categorize-box-according-to-criteria__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 four integers length, width, height, and mass, representing the dime...
categorize-box-according-to-criteria
categorize-box-according-to-criteria__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 four integers length, width, height, and mass, representing the dime...
find-consecutive-integers-from-a-data-stream
find-consecutive-integers-from-a-data-stream__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\nFor a stream of integers, implement a data structure that checks if the la...
find-xor-beauty-of-array
find-xor-beauty-of-array__01__java
Bit Manipulation
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array nums.\n\nThe effective value of th...
maximize-the-minimum-powered-city
maximize-the-minimum-powered-city__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 stations of length n, where statio...
maximum-count-of-positive-integer-and-negative-integer
maximum-count-of-positive-integer-and-negative-integer__01__java
Binary Search
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven an array nums sorted in non-decreasing order, return the maximum bet...
maximum-count-of-positive-integer-and-negative-integer
maximum-count-of-positive-integer-and-negative-integer__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 array nums sorted in non-decreasing order, return the maximum bet...
maximal-score-after-applying-k-operations
maximal-score-after-applying-k-operations__01__java
Heap
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array nums and an integer k. You have a ...
make-number-of-distinct-characters-equal
make-number-of-distinct-characters-equal__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 word1 and word2.\n\nA move consists of...
time-to-cross-a-bridge
time-to-cross-a-bridge__01__java
Heap
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nThere are k workers who want to move n boxes from the right (old) warehous...
number-of-good-binary-strings
number-of-good-binary-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\nYou are given four integers minLength, maxLength, oneGroup and zeroGroup.\...
time-taken-to-cross-the-door
time-taken-to-cross-the-door__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 are n persons numbered from 0 to n - 1 and a door. Each person can e...
difference-between-element-sum-and-digit-sum-of-an-array
difference-between-element-sum-and-digit-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 positive integer array nums.\n\n\tThe element sum is the s...
increment-submatrices-by-one
increment-submatrices-by-one__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 positive integer n, indicating that we initially have an n...
count-the-number-of-good-subarrays
count-the-number-of-good-subarrays__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 an integer array nums and an integer k, return the number of good su...
difference-between-maximum-and-minimum-price-sum
difference-between-maximum-and-minimum-price-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\nThere exists an undirected and initially unrooted tree with n nodes indexe...
count-the-number-of-good-subsequences
count-the-number-of-good-subsequences__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 subsequence of a string is good if it is not empty and the frequency of ...
minimum-common-value
minimum-common-value__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 two integer arrays nums1 and nums2, sorted in non-decreasing order, ...
minimum-operations-to-make-array-equal-ii
minimum-operations-to-make-array-equal-ii__01__java
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given two integer arrays nums1 and nums2 of equal length n and an ...
maximum-subsequence-score
maximum-subsequence-score__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 0-indexed integer arrays nums1 and nums2 of equal length...
check-if-point-is-reachable
check-if-point-is-reachable__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 exists an infinitely large grid. You are currently at point (1, 1), ...
alternating-digit-sum
alternating-digit-sum__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a positive integer n. Each digit of n has a sign according t...
sort-the-students-by-their-kth-score
sort-the-students-by-their-kth-score__01__java
Sorting
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nThere is a class with m students and n exams. You are given a 0-indexed m ...
apply-bitwise-operations-to-make-strings-equal
apply-bitwise-operations-to-make-strings-equal__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 two 0-indexed binary strings s and target of the same length...
minimum-cost-to-split-an-array
minimum-cost-to-split-an-array__01__java
Memoization
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums and an integer k.\n\nSplit the array i...
maximum-price-to-fill-a-bag
maximum-price-to-fill-a-bag__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 items where items[i] = [pricei, weighti] ...
count-distinct-numbers-on-board
count-distinct-numbers-on-board__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 positive integer n, that is initially placed on a board. E...
count-collisions-of-monkeys-on-a-polygon
count-collisions-of-monkeys-on-a-polygon__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 regular convex polygon with n vertices. The vertices are labele...
put-marbles-in-bags
put-marbles-in-bags__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 have k bags. You are given a 0-indexed integer array weights where wei...
count-increasing-quadruplets
count-increasing-quadruplets__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 0-indexed integer array nums of size n containing all numbers from...
separate-the-digits-in-an-array
separate-the-digits-in-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\nGiven an array of positive integers nums, return an array answer that cons...
maximum-number-of-integers-to-choose-from-a-range-i
maximum-number-of-integers-to-choose-from-a-range-i__01__java
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array banned and two integers n and maxSum. You a...
maximum-number-of-integers-to-choose-from-a-range-i
maximum-number-of-integers-to-choose-from-a-range-i__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 an integer array banned and two integers n and maxSum. You a...
maximize-win-from-two-segments
maximize-win-from-two-segments__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 some prizes on the X-axis. You are given an integer array prizeP...
disconnect-path-in-a-binary-matrix-by-at-most-one-flip
disconnect-path-in-a-binary-matrix-by-at-most-one-flip__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 0-indexed m x n binary matrix grid. You can move from a ce...
maximum-number-of-integers-to-choose-from-a-range-ii
maximum-number-of-integers-to-choose-from-a-range-ii__01__java
Binary Search
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array banned and two integers n and maxSum. You a...
take-gifts-from-the-richest-pile
take-gifts-from-the-richest-pile__01__java
Heap
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array gifts denoting the number of gifts in vario...
count-vowel-strings-in-ranges
count-vowel-strings-in-ranges__01__java
Binary Search
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed array of strings words and a 2D array of integer...
count-vowel-strings-in-ranges
count-vowel-strings-in-ranges__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\nYou are given a 0-indexed array of strings words and a 2D array of integer...
house-robber-iv
house-robber-iv__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 are several consecutive houses along a street, each of which has som...
rearranging-fruits
rearranging-fruits__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 two fruit baskets containing n fruits each. You are given two 0-i...
find-the-array-concatenation-value
find-the-array-concatenation-value__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.\n\nThe concatenation of two ...
count-the-number-of-fair-pairs
count-the-number-of-fair-pairs__01__java
Binary Search
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven a 0-indexed integer array nums of size n and two integers lower and ...
substring-xor-queries
substring-xor-queries__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 binary string s, and a 2D integer array queries where quer...
subsequence-with-the-minimum-score
subsequence-with-the-minimum-score__01__java
Binary Search
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given two strings s and t.\n\nYou are allowed to remove any number...
maximum-difference-by-remapping-a-digit
maximum-difference-by-remapping-a-digit__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 num. You know that Bob will sneakily remap one of...
minimum-score-by-changing-two-elements
minimum-score-by-changing-two-elements__01__java
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums.\n\n\tThe low score of nums is the min...
minimum-impossible-or
minimum-impossible-or__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 0-indexed integer array nums.\n\nWe say that an integer x ...
handling-sum-queries-after-update
handling-sum-queries-after-update__01__java
Array
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given two 0-indexed arrays nums1 and nums2 and a 2D array queries ...
merge-two-2d-arrays-by-summing-values
merge-two-2d-arrays-by-summing-values__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 two 2D integer arrays nums1 and nums2.\n\n\tnums1[i] = [idi,...
minimum-operations-to-reduce-an-integer-to-0
minimum-operations-to-reduce-an-integer-to-0__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 positive integer n, you can do the following operation any...
count-the-number-of-square-free-subsets
count-the-number-of-square-free-subsets__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 positive integer 0-indexed array nums.\n\nA subset of the ...
find-the-string-with-lcp
find-the-string-with-lcp__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 define the lcp matrix of any 0-indexed string word of n lowercase Engli...
left-and-right-sum-differences
left-and-right-sum-differences__01__java
Array
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array nums of size n.\n\nDefine two arra...
find-the-divisibility-array-of-a-string
find-the-divisibility-array-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 0-indexed string word of length n consisting of digits, an...
find-the-maximum-number-of-marked-indices
find-the-maximum-number-of-marked-indices__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.\n\nInitially, all of the ind...
minimum-time-to-visit-a-cell-in-a-grid
minimum-time-to-visit-a-cell-in-a-grid__01__java
Heap
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a m x n matrix grid consisting of non-negative integers wher...
split-with-minimum-sum
split-with-minimum-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\nGiven a positive integer num, split it into two non-negative integers num1...
split-with-minimum-sum
split-with-minimum-sum__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\nGiven a positive integer num, split it into two non-negative integers num1...
count-total-number-of-colored-cells
count-total-number-of-colored-cells__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 exists an infinitely large two-dimensional grid of uncolored unit ce...
count-ways-to-group-overlapping-ranges
count-ways-to-group-overlapping-ranges__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 ranges where ranges[i] = [starti, endi] d...
count-ways-to-group-overlapping-ranges
count-ways-to-group-overlapping-ranges__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 2D integer array ranges where ranges[i] = [starti, endi] d...
count-number-of-possible-root-nodes
count-number-of-possible-root-nodes__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 has an undirected tree with n nodes labeled from 0 to n - 1. The tre...
pass-the-pillow
pass-the-pillow__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 are n people standing in a line labeled from 1 to n. The first perso...
pass-the-pillow
pass-the-pillow__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\nThere are n people standing in a line labeled from 1 to n. The first perso...