slug
stringlengths
3
79
solution_id
stringlengths
13
89
primary_algorithm
stringclasses
22 values
verified
null
messages
listlengths
3
3
maximum-earnings-from-taxi
maximum-earnings-from-taxi__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 points on a road you are driving your taxi on. The n points on...
minimum-number-of-operations-to-make-array-continuous
minimum-number-of-operations-to-make-array-continuous__01__java
Binary Search
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums. In one operation, you can replace any...
minimum-number-of-operations-to-make-array-continuous
minimum-number-of-operations-to-make-array-continuous__02__java
Two Pointers
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums. In one operation, you can replace any...
final-value-of-variable-after-performing-operations
final-value-of-variable-after-performing-operations__01__java
Array
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nThere is a programming language with only four operations and one variable...
sum-of-beauty-in-the-array
sum-of-beauty-in-the-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. For each index i (1 <= i <= ...
detect-squares
detect-squares__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 stream of points on the X-Y plane. Design an algorithm tha...
longest-subsequence-repeated-k-times
longest-subsequence-repeated-k-times__01__java
BFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a string s of length n, and an integer k. You are tasked to ...
average-height-of-buildings-in-each-segment
average-height-of-buildings-in-each-segment__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\nA perfectly straight street is represented by a number line. The street ha...
maximum-difference-between-increasing-elements
maximum-difference-between-increasing-elements__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 a 0-indexed integer array nums of size n, find the maximum differenc...
grid-game
grid-game__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 2D array grid of size 2 x n, where grid[r][c] re...
check-if-word-can-be-placed-in-crossword
check-if-word-can-be-placed-in-crossword__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 matrix board, representing the current state of a c...
the-score-of-students-solving-math-expression
the-score-of-students-solving-math-expression__01__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a string s that contains digits 0-9, addition symbols '+', a...
brightest-position-on-street
brightest-position-on-street__01__java
Sorting
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nA perfectly straight street is represented by a number line. The street ha...
convert-1d-array-into-2d-array
convert-1d-array-into-2d-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 1-dimensional (1D) integer array original, and t...
number-of-pairs-of-strings-with-concatenation-equal-to-target
number-of-pairs-of-strings-with-concatenation-equal-to-target__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 digit strings nums and a digit string target, return the...
number-of-pairs-of-strings-with-concatenation-equal-to-target
number-of-pairs-of-strings-with-concatenation-equal-to-target__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\nGiven an array of digit strings nums and a digit string target, return the...
maximize-the-confusion-of-an-exam
maximize-the-confusion-of-an-exam__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 teacher is writing a test with n true/false questions, with 'T' denoting...
maximum-number-of-ways-to-partition-an-array
maximum-number-of-ways-to-partition-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 integer array nums of length n. The number of wa...
minimum-moves-to-convert-string
minimum-moves-to-convert-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 string s consisting of n characters which are either 'X' o...
find-missing-observations
find-missing-observations__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou have observations of n + m 6-sided dice rolls with each face numbered ...
stone-game-ix
stone-game-ix__01__java
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nAlice and Bob continue their games with stones. There is a row of n stones...
smallest-k-length-subsequence-with-occurrences-of-a-letter
smallest-k-length-subsequence-with-occurrences-of-a-letter__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 s, an integer k, a letter letter, and an integer re...
count-subarrays-with-more-ones-than-zeros
count-subarrays-with-more-ones-than-zeros__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 binary array nums containing only the integers 0 and 1. Re...
two-out-of-three
two-out-of-three__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 three integer arrays nums1, nums2, and nums3, return a distinct arra...
two-out-of-three
two-out-of-three__02__java
Bit Manipulation
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven three integer arrays nums1, nums2, and nums3, return a distinct arra...
minimum-operations-to-make-a-uni-value-grid
minimum-operations-to-make-a-uni-value-grid__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 grid of size m x n and an integer x. In one ope...
stock-price-fluctuation
stock-price-fluctuation__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 stream of records about a particular stock. Each record co...
partition-array-into-two-arrays-to-minimize-sum-difference
partition-array-into-two-arrays-to-minimize-sum-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\nYou are given an integer array nums of 2 * n integers. You need to partiti...
maximum-alternating-subarray-sum
maximum-alternating-subarray-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\nA subarray of a 0-indexed integer array is a contiguous non-empty sequence...
minimum-number-of-moves-to-seat-everyone
minimum-number-of-moves-to-seat-everyone__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 availabe seats and n students standing in a room. You are give...
remove-colored-pieces-if-both-neighbors-are-the-same-color
remove-colored-pieces-if-both-neighbors-are-the-same-color__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 n pieces arranged in a line, and each piece is colored either by...
the-time-when-the-network-becomes-idle
the-time-when-the-network-becomes-idle__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\nThere is a network of n servers, labeled from 0 to n - 1. You are given a ...
kth-smallest-product-of-two-sorted-arrays
kth-smallest-product-of-two-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 two sorted 0-indexed integer arrays nums1 and nums2 as well as an in...
check-if-numbers-are-ascending-in-a-sentence
check-if-numbers-are-ascending-in-a-sentence__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 list of tokens separated by a single space with no leading...
simple-bank-system
simple-bank-system__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou have been tasked with writing a program for a popular bank that will a...
count-number-of-maximum-bitwise-or-subsets
count-number-of-maximum-bitwise-or-subsets__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 an integer array nums, find the maximum possible bitwise OR of a sub...
count-number-of-maximum-bitwise-or-subsets
count-number-of-maximum-bitwise-or-subsets__02__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\nGiven an integer array nums, find the maximum possible bitwise OR of a sub...
second-minimum-time-to-reach-destination
second-minimum-time-to-reach-destination__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 city is represented as a bi-directional connected graph with n vertices ...
sort-linked-list-already-sorted-using-absolute-values
sort-linked-list-already-sorted-using-absolute-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\nGiven the head of a singly linked list that is sorted in non-decreasing or...
number-of-valid-words-in-a-sentence
number-of-valid-words-in-a-sentence__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 consists of lowercase letters ('a' to 'z'), digits ('0' to '9')...
next-greater-numerically-balanced-number
next-greater-numerically-balanced-number__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\nAn integer x is numerically balanced if for every digit d in the number x,...
count-nodes-with-the-highest-score
count-nodes-with-the-highest-score__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 is a binary tree rooted at 0 consisting of n nodes. The nodes are la...
parallel-courses-iii
parallel-courses-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\nYou are given an integer n, which indicates that there are n courses label...
minimum-cost-to-separate-sentence-into-rows
minimum-cost-to-separate-sentence-into-rows__01__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a string sentence containing words separated by spaces, and ...
kth-distinct-string-in-an-array
kth-distinct-string-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\nA distinct string is a string that is present only once in an array.\n\nGi...
two-best-non-overlapping-events
two-best-non-overlapping-events__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 of events where events[i] = [st...
plates-between-candles
plates-between-candles__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\nThere is a long table with a line of plates and candles arranged on top of...
number-of-valid-move-combinations-on-chessboard
number-of-valid-move-combinations-on-chessboard__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 is an 8 x 8 chessboard containing n pieces (rooks, queens, or bishop...
smallest-index-with-equal-value
smallest-index-with-equal-value__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 a 0-indexed integer array nums, return the smallest index i of nums ...
find-the-minimum-and-maximum-number-of-nodes-between-critical-points
find-the-minimum-and-maximum-number-of-nodes-between-critical-points__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\nA critical point in a linked list is defined as either a local maxima or a...
minimum-operations-to-convert-number
minimum-operations-to-convert-number__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 integer array nums containing distinct numbers, ...
minimum-operations-to-convert-number
minimum-operations-to-convert-number__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 0-indexed integer array nums containing distinct numbers, ...
minimum-operations-to-convert-number
minimum-operations-to-convert-number__03__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 integer array nums containing distinct numbers, ...
number-of-spaces-cleaning-robot-cleaned
number-of-spaces-cleaning-robot-cleaned__01__java
Array
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nA room is represented by a 0-indexed 2D binary matrix room where a 0 repre...
number-of-spaces-cleaning-robot-cleaned
number-of-spaces-cleaning-robot-cleaned__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\nA room is represented by a 0-indexed 2D binary matrix room where a 0 repre...
count-vowel-substrings-of-a-string
count-vowel-substrings-of-a-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\nA substring is a contiguous (non-empty) sequence of characters within a st...
vowels-of-all-substrings
vowels-of-all-substrings__01__java
Brute Force
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven a string word, return the sum of the number of vowels ('a', 'e', 'i'...
minimized-maximum-of-products-distributed-to-any-store
minimized-maximum-of-products-distributed-to-any-store__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 indicating there are n specialty retail stores....
maximum-path-quality-of-a-graph
maximum-path-quality-of-a-graph__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 is an undirected graph with n nodes numbered from 0 to n - 1 (inclus...
number-of-equal-count-substrings
number-of-equal-count-substrings__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 0-indexed string s consisting of only lowercase English le...
check-whether-two-strings-are-almost-equivalent
check-whether-two-strings-are-almost-equivalent__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\nTwo strings word1 and word2 are considered almost equivalent if the differ...
walking-robot-simulation-ii
walking-robot-simulation-ii__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\nA width x height grid is on an XY-plane with the bottom-left cell at (0, 0...
most-beautiful-item-for-each-query
most-beautiful-item-for-each-query__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 items where items[i] = [pricei, beautyi] ...
most-beautiful-item-for-each-query
most-beautiful-item-for-each-query__02__java
Binary Search
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 2D integer array items where items[i] = [pricei, beautyi] ...
maximum-number-of-tasks-you-can-assign
maximum-number-of-tasks-you-can-assign__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 tasks and m workers. Each task has a strength requirement store...
time-needed-to-buy-tickets
time-needed-to-buy-tickets__01__java
Array
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nThere are n people in a line queuing to buy tickets, where the 0th person ...
reverse-nodes-in-even-length-groups
reverse-nodes-in-even-length-groups__01__java
Linked List
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given the head of a linked list.\n\nThe nodes in the linked list a...
decode-the-slanted-ciphertext
decode-the-slanted-ciphertext__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 string originalText is encoded using a slanted transposition cipher to a...
process-restricted-friend-requests
process-restricted-friend-requests__01__java
Graph
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer n indicating the number of people in a network. E...
paths-in-maze-that-lead-to-same-room
paths-in-maze-that-lead-to-same-room__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\nA maze consists of n rooms numbered from 1 to n, and some rooms are connec...
two-furthest-houses-with-different-colors
two-furthest-houses-with-different-colors__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 n houses evenly lined up on the street, and each house is beauti...
watering-plants
watering-plants__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 want to water n plants in your garden with a watering can. The plants ...
range-frequency-queries
range-frequency-queries__01__java
Binary Search
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nDesign a data structure to find the frequency of a given value in a given ...
sum-of-k-mirror-numbers
sum-of-k-mirror-numbers__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nA k-mirror number is a positive integer without leading zeros that reads t...
substrings-that-begin-and-end-with-the-same-letter
substrings-that-begin-and-end-with-the-same-letter__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 s consisting of only lowercase English le...
count-common-words-with-one-occurrence
count-common-words-with-one-occurrence__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 string arrays words1 and words2, return the number of strings th...
minimum-number-of-food-buckets-to-feed-the-hamsters
minimum-number-of-food-buckets-to-feed-the-hamsters__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 string hamsters where hamsters[i] is either:\n\n...
minimum-cost-homecoming-of-a-robot-in-a-grid
minimum-cost-homecoming-of-a-robot-in-a-grid__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 m x n grid, where (0, 0) is the top-left cell and (m - 1, n - ...
count-fertile-pyramids-in-a-land
count-fertile-pyramids-in-a-land__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 farmer has a rectangular grid of land with m rows and n columns that can...
find-target-indices-after-sorting-array
find-target-indices-after-sorting-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\nYou are given a 0-indexed integer array nums and a target element target.\...
k-radius-subarray-averages
k-radius-subarray-averages__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 0-indexed array nums of n integers, and an integer k.\n\nT...
removing-minimum-and-maximum-from-array
removing-minimum-and-maximum-from-array__01__java
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed array of distinct integers nums.\n\nThere is an ...
find-all-people-with-secret
find-all-people-with-secret__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 indicating there are n people numbered from 0 t...
minimum-cost-to-reach-city-with-discounts
minimum-cost-to-reach-city-with-discounts__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\nA series of highways connect n cities numbered from 0 to n - 1. You are gi...
finding-3-digit-even-numbers
finding-3-digit-even-numbers__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 digits, where each element is a digit. The ...
delete-the-middle-node-of-a-linked-list
delete-the-middle-node-of-a-linked-list__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 the head of a linked list. Delete the middle node, and retur...
step-by-step-directions-from-a-binary-tree-node-to-another
step-by-step-directions-from-a-binary-tree-node-to-another__01__java
DFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given the root of a binary tree with n nodes. Each node is uniquel...
step-by-step-directions-from-a-binary-tree-node-to-another
step-by-step-directions-from-a-binary-tree-node-to-another__02__java
DFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given the root of a binary tree with n nodes. Each node is uniquel...
valid-arrangement-of-pairs
valid-arrangement-of-pairs__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 2D integer array pairs where pairs[i] = [starti,...
subsequence-of-size-k-with-the-largest-even-sum
subsequence-of-size-k-with-the-largest-even-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 integer array nums and an integer k. Find the largest eve...
find-subsequence-of-length-k-with-the-largest-sum
find-subsequence-of-length-k-with-the-largest-sum__01__java
Sorting
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums and an integer k. You want to find a s...
find-good-days-to-rob-the-bank
find-good-days-to-rob-the-bank__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 and a gang of thieves are planning on robbing a bank. You are given a ...
detonate-the-maximum-bombs
detonate-the-maximum-bombs__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 list of bombs. The range of a bomb is defined as the area ...
sequentially-ordinal-rank-tracker
sequentially-ordinal-rank-tracker__02__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\nA scenic location is represented by its name and attractiveness score, whe...
rings-and-rods
rings-and-rods__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\nThere are n rings and each ring is either red, green, or blue. The rings a...
sum-of-subarray-ranges
sum-of-subarray-ranges__01__java
Array
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums. The range of a subarray of nums is th...
sum-of-subarray-ranges
sum-of-subarray-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 an integer array nums. The range of a subarray of nums is th...
watering-plants-ii
watering-plants-ii__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\nAlice and Bob want to water n plants in their garden. The plants are arran...
maximum-fruits-harvested-after-at-most-k-steps
maximum-fruits-harvested-after-at-most-k-steps__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\nFruits are available at some positions on an infinite x-axis. You are give...
number-of-unique-flavors-after-sharing-k-candies
number-of-unique-flavors-after-sharing-k-candies__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 0-indexed integer array candies, where candies[i] represen...