slug
stringlengths
3
79
solution_id
stringlengths
13
89
primary_algorithm
stringclasses
22 values
verified
null
messages
listlengths
3
3
matrix-cells-in-distance-order
matrix-cells-in-distance-order__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 four integers row, cols, rCenter, and cCenter. There is a ro...
maximum-sum-of-two-non-overlapping-subarrays
maximum-sum-of-two-non-overlapping-subarrays__01__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums and two integers firstLen and secondLen, retur...
stream-of-characters
stream-of-characters__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\nDesign an algorithm that accepts a stream of characters and checks if a su...
moving-stones-until-consecutive
moving-stones-until-consecutive__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 three stones in different positions on the X-axis. You are given...
coloring-a-border
coloring-a-border__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 an m x n integer matrix grid, and three integers row, col, a...
uncrossed-lines
uncrossed-lines__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 integer arrays nums1 and nums2. We write the integers of...
escape-a-large-maze
escape-a-large-maze__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 1 million by 1 million grid on an XY-plane, and the coordinates...
valid-boomerang
valid-boomerang__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 points where points[i] = [xi, yi] represents a point on the...
binary-search-tree-to-greater-sum-tree
binary-search-tree-to-greater-sum-tree__01__java
Recursion
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven the root of a Binary Search Tree (BST), convert it to a Greater Tree...
binary-search-tree-to-greater-sum-tree
binary-search-tree-to-greater-sum-tree__02__java
DFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven the root of a Binary Search Tree (BST), convert it to a Greater Tree...
minimum-score-triangulation-of-polygon
minimum-score-triangulation-of-polygon__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 have a convex n-sided polygon where each vertex has an integer value. ...
minimum-score-triangulation-of-polygon
minimum-score-triangulation-of-polygon__02__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou have a convex n-sided polygon where each vertex has an integer value. ...
minimum-score-triangulation-of-polygon
minimum-score-triangulation-of-polygon__03__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou have a convex n-sided polygon where each vertex has an integer value. ...
moving-stones-until-consecutive-ii
moving-stones-until-consecutive-ii__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\nThere are some stones in different positions on the X-axis. You are given ...
robot-bounded-in-circle
robot-bounded-in-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\nOn an infinite plane, a robot initially stands at (0, 0) and faces north. ...
flower-planting-with-no-adjacent
flower-planting-with-no-adjacent__01__java
DFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou have n gardens, labeled from 1 to n, and an array paths where paths[i]...
partition-array-for-maximum-sum
partition-array-for-maximum-sum__01__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven an integer array arr, partition the array into (contiguous) subarray...
longest-duplicate-substring
longest-duplicate-substring__01__java
Sliding Window
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven a string s, consider all duplicated substrings: (contiguous) substri...
last-stone-weight
last-stone-weight__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 array of integers stones where stones[i] is the weight of...
remove-all-adjacent-duplicates-in-string
remove-all-adjacent-duplicates-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 s consisting of lowercase English letters. A duplic...
longest-string-chain
longest-string-chain__01__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an array of words where each word consists of lowercase Engl...
last-stone-weight-ii
last-stone-weight-ii__01__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an array of integers stones where stones[i] is the weight of...
last-stone-weight-ii
last-stone-weight-ii__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 an array of integers stones where stones[i] is the weight of...
height-checker
height-checker__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 school is trying to take an annual photo of all the students. The studen...
height-checker
height-checker__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\nA school is trying to take an annual photo of all the students. The studen...
grumpy-bookstore-owner
grumpy-bookstore-owner__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\nThere is a bookstore owner that has a store open for n minutes. You are gi...
previous-permutation-with-one-swap
previous-permutation-with-one-swap__01__java
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven an array of positive integers arr (not necessarily distinct), return...
distant-barcodes
distant-barcodes__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\nIn a warehouse, there is a row of barcodes, where the ith barcode is barco...
shortest-way-to-form-string
shortest-way-to-form-string__01__java
Two Pointers
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nA subsequence of a string is a new string that is formed from the original...
confusing-number
confusing-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\nA confusing number is a number that when rotated 180 degrees becomes a dif...
campus-bikes
campus-bikes__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\nOn a campus represented on the X-Y plane, there are n workers and m bikes,...
minimize-rounding-error-to-meet-target
minimize-rounding-error-to-meet-target__01__java
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven an array of prices [p1,p2...,pn] and a target, round each price pi t...
all-paths-from-source-lead-to-destination
all-paths-from-source-lead-to-destination__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 edges of a directed graph where edges[i] = [ai, bi] indicates th...
missing-element-in-sorted-array
missing-element-in-sorted-array__01__java
Binary Search
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums which is sorted in ascending order and all of ...
lexicographically-smallest-equivalent-string
lexicographically-smallest-equivalent-string__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 two strings of the same length s1 and s2 and a string baseSt...
longest-repeating-substring
longest-repeating-substring__01__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven a string s, return the length of the longest repeating substrings. I...
number-of-valid-subarrays
number-of-valid-subarrays__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, return the number of non-empty subarrays with...
number-of-valid-subarrays
number-of-valid-subarrays__02__java
Array
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums, return the number of non-empty subarrays with...
fixed-point
fixed-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\nGiven an array of distinct integers arr, where arr is sorted in ascending ...
index-pairs-of-a-string
index-pairs-of-a-string__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 string text and an array of strings words, return an array of all ...
campus-bikes-ii
campus-bikes-ii__01__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nOn a campus represented as a 2D grid, there are n workers and m bikes, wit...
digit-count-in-range
digit-count-in-range__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 single-digit integer d and two integers low and high, return the n...
greatest-common-divisor-of-strings
greatest-common-divisor-of-strings__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\nFor two strings s and t, we say \"t divides s\" if and only if s = t + t +...
flip-columns-for-maximum-number-of-equal-rows
flip-columns-for-maximum-number-of-equal-rows__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 m x n binary matrix matrix.\n\nYou can choose any number ...
adding-two-negabinary-numbers
adding-two-negabinary-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\nGiven two numbers arr1 and arr2 in base -2, return the result of adding th...
number-of-submatrices-that-sum-to-target
number-of-submatrices-that-sum-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 a matrix and a target, return the number of non-empty submatrices th...
occurrences-after-bigram
occurrences-after-bigram__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 two strings first and second, consider occurrences in some text of t...
letter-tile-possibilities
letter-tile-possibilities__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\nYou have n tiles, where each tile has one letter tiles[i] printed on it.\...
insufficient-nodes-in-root-to-leaf-paths
insufficient-nodes-in-root-to-leaf-paths__01__java
DFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven the root of a binary tree and an integer limit, delete all insuffici...
smallest-subsequence-of-distinct-characters
smallest-subsequence-of-distinct-characters__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 string s, return the lexicographically smallest subsequence of s t...
smallest-subsequence-of-distinct-characters
smallest-subsequence-of-distinct-characters__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 string s, return the lexicographically smallest subsequence of s t...
sum-of-digits-in-the-minimum-number
sum-of-digits-in-the-minimum-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 array nums, return 0 if the sum of the digits of the mini...
high-five
high-five__01__java
Sorting
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven a list of the scores of different students, items, where items[i] = ...
brace-expansion
brace-expansion__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\nYou are given a string s representing a list of words. Each letter in the ...
confusing-number-ii
confusing-number-ii__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\nA confusing number is a number that when rotated 180 degrees becomes a dif...
duplicate-zeros
duplicate-zeros__01__java
Two Pointers
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven a fixed-length integer array arr, duplicate each occurrence of zero,...
largest-values-from-labels
largest-values-from-labels__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 n item's value and label as two integer arrays values and la...
shortest-path-in-binary-matrix
shortest-path-in-binary-matrix__01__java
BFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven an n x n binary matrix grid, return the length of the shortest clear...
shortest-common-supersequence
shortest-common-supersequence__01__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven two strings str1 and str2, return the shortest string that has both ...
statistics-from-a-large-sample
statistics-from-a-large-sample__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 large sample of integers in the range [0, 255]. Since the ...
car-pooling
car-pooling__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 car with capacity empty seats. The vehicle only drives east (i....
find-in-mountain-array
find-in-mountain-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\n(This problem is an interactive problem.)\n\nYou may recall that an array ...
brace-expansion-ii
brace-expansion-ii__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\nUnder the grammar given below, strings can represent a set of lowercase wo...
two-sum-less-than-k
two-sum-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\nGiven an array nums of integers and integer k, return the maximum sum such...
two-sum-less-than-k
two-sum-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\nGiven an array nums of integers and integer k, return the maximum sum such...
find-k-length-substrings-with-no-repeated-characters
find-k-length-substrings-with-no-repeated-characters__01__java
Sliding Window
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven a string s and an integer k, return the number of substrings in s of...
the-earliest-moment-when-everyone-become-friends
the-earliest-moment-when-everyone-become-friends__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 people in a social group labeled from 0 to n - 1. You are give...
the-earliest-moment-when-everyone-become-friends
the-earliest-moment-when-everyone-become-friends__02__java
Graph
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nThere are n people in a social group labeled from 0 to n - 1. You are give...
path-with-maximum-minimum-value
path-with-maximum-minimum-value__01__java
Sorting
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven an m x n integer matrix grid, return the maximum score of a path sta...
path-with-maximum-minimum-value
path-with-maximum-minimum-value__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 m x n integer matrix grid, return the maximum score of a path sta...
distribute-candies-to-people
distribute-candies-to-people__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\nWe distribute some number of candies, to a row of n = num_people people in...
path-in-zigzag-labelled-binary-tree
path-in-zigzag-labelled-binary-tree__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nIn an infinite binary tree where every node has two children, the nodes ar...
filling-bookcase-shelves
filling-bookcase-shelves__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 books where books[i] = [thicknessi, heighti] indica...
parsing-a-boolean-expression
parsing-a-boolean-expression__01__java
Recursion
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nA boolean expression is an expression that evaluates to either true or fal...
defanging-an-ip-address
defanging-an-ip-address__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 valid (IPv4) IP address, return a defanged version of that IP addr...
corporate-flight-bookings
corporate-flight-bookings__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 flights that are labeled from 1 to n.\n\nYou are given an arra...
corporate-flight-bookings
corporate-flight-bookings__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\nThere are n flights that are labeled from 1 to n.\n\nYou are given an arra...
delete-nodes-and-return-forest
delete-nodes-and-return-forest__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, each node in the tree has a distinct valu...
maximum-nesting-depth-of-two-valid-parentheses-strings
maximum-nesting-depth-of-two-valid-parentheses-strings__01__java
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nA string is a valid parentheses string (denoted VPS) if and only if it con...
print-in-order
print-in-order__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\nSuppose we have a class:\n\npublic class Foo {\n public void first() { pr...
print-foobar-alternately
print-foobar-alternately__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\nSuppose you are given the following code:\n\nclass FooBar {\n public void...
print-zero-even-odd
print-zero-even-odd__01__java
Brute Force
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou have a function printNumber that can be called with an integer paramet...
building-h2o
building-h2o__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\nThere are two kinds of threads: oxygen and hydrogen. Your goal is to group...
number-of-days-in-a-month
number-of-days-in-a-month__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 year year and a month month, return the number of days of that mon...
remove-vowels-from-a-string
remove-vowels-from-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\nGiven a string s, remove the vowels 'a', 'e', 'i', 'o', and 'u' from it, a...
maximum-average-subtree
maximum-average-subtree__01__java
Recursion
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven the root of a binary tree, return the maximum average value of a sub...
divide-array-into-increasing-sequences
divide-array-into-increasing-sequences__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 sorted in non-decreasing order and an integer ...
divide-array-into-increasing-sequences
divide-array-into-increasing-sequences__02__java
Array
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums sorted in non-decreasing order and an integer ...
relative-sort-array
relative-sort-array__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 two arrays arr1 and arr2, the elements of arr2 are distinct, and all...
relative-sort-array
relative-sort-array__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 two arrays arr1 and arr2, the elements of arr2 are distinct, and all...
lowest-common-ancestor-of-deepest-leaves
lowest-common-ancestor-of-deepest-leaves__01__java
DFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven the root of a binary tree, return the lowest common ancestor of its ...
longest-well-performing-interval
longest-well-performing-interval__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\nWe are given hours, a list of the number of hours worked per day for a giv...
smallest-sufficient-team
smallest-sufficient-team__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\nIn a project, you have a list of required skills req_skills, and a list of...
number-of-equivalent-domino-pairs
number-of-equivalent-domino-pairs__01__java
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven a list of dominoes, dominoes[i] = [a, b] is equivalent to dominoes[j...
shortest-path-with-alternating-colors
shortest-path-with-alternating-colors__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 integer n, the number of nodes in a directed graph where ...
minimum-cost-tree-from-leaf-values
minimum-cost-tree-from-leaf-values__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\nGiven an array arr of positive integers, consider all binary trees such th...
minimum-cost-tree-from-leaf-values
minimum-cost-tree-from-leaf-values__02__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven an array arr of positive integers, consider all binary trees such th...
maximum-of-absolute-value-expression
maximum-of-absolute-value-expression__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 arrays of integers with equal lengths, return the maximum value ...
largest-unique-number
largest-unique-number__01__java
Sorting
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums, return the largest integer that only occurs o...
armstrong-number
armstrong-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 n, return true if and only if it is an Armstrong number.\...