slug
stringlengths
3
79
solution_id
stringlengths
13
89
primary_algorithm
stringclasses
22 values
verified
null
messages
listlengths
3
3
remove-one-element-to-make-the-array-strictly-increasing
remove-one-element-to-make-the-array-strictly-increasing__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 true if it can be made strict...
remove-all-occurrences-of-a-substring
remove-all-occurrences-of-a-substring__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 s and part, perform the following operation on s until a...
maximum-alternating-subsequence-sum
maximum-alternating-subsequence-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\nThe alternating sum of a 0-indexed array is defined as the sum of the elem...
maximum-alternating-subsequence-sum
maximum-alternating-subsequence-sum__02__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nThe alternating sum of a 0-indexed array is defined as the sum of the elem...
design-movie-rental-system
design-movie-rental-system__01__java
Heap
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou have a movie renting company consisting of n shops. You want to implem...
maximum-product-difference-between-two-pairs
maximum-product-difference-between-two-pairs__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\nThe product difference between two pairs (a, b) and (c, d) is defined as (...
cyclically-rotating-a-grid
cyclically-rotating-a-grid__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an m x n integer matrix grid​​​, where m and n are both even...
number-of-wonderful-substrings
number-of-wonderful-substrings__01__java
Bit Manipulation
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nA wonderful string is a string where at most one letter appears an odd num...
count-ways-to-build-rooms-in-an-ant-colony
count-ways-to-build-rooms-in-an-ant-colony__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 an ant tasked with adding n new rooms numbered 0 to n-1 to your co...
kth-smallest-subarray-sum
kth-smallest-subarray-sum__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 of length n and an integer k, return the kth s...
build-array-from-permutation
build-array-from-permutation__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 zero-based permutation nums (0-indexed), build an array ans of the...
eliminate-maximum-number-of-monsters
eliminate-maximum-number-of-monsters__01__java
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are playing a video game where you are defending your city from a grou...
count-good-numbers
count-good-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 digit string is good if the digits (0-indexed) at even indices are even ...
longest-common-subpath
longest-common-subpath__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 country of n cities numbered from 0 to n - 1. In this country, ...
erect-the-fence-ii
erect-the-fence-ii__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 2D integer array trees where trees[i] = [xi, yi] represent...
count-square-sum-triples
count-square-sum-triples__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 square triple (a,b,c) is a triple where a, b, and c are integers and a2 ...
nearest-exit-from-entrance-in-maze
nearest-exit-from-entrance-in-maze__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 matrix maze (0-indexed) with empty cells (represent...
sum-game
sum-game__01__java
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nAlice and Bob take turns playing a game, with Alice starting first.\n\nYou...
minimum-cost-to-reach-destination-in-time
minimum-cost-to-reach-destination-in-time__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 is a country of n cities numbered from 0 to n - 1 where all the citi...
concatenation-of-array
concatenation-of-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 integer array nums of length n, you want to create an array ans o...
unique-length-3-palindromic-subsequences
unique-length-3-palindromic-subsequences__01__java
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven a string s, return the number of unique palindromes of length three ...
painting-a-grid-with-three-different-colors
painting-a-grid-with-three-different-colors__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 integers m and n. Consider an m x n grid where each cell...
merge-bsts-to-create-single-bst
merge-bsts-to-create-single-bst__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 n BST (binary search tree) root nodes for n separate BSTs st...
check-if-string-is-decomposable-into-value-equal-substrings
check-if-string-is-decomposable-into-value-equal-substrings__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 value-equal string is a string where all characters are the same.\n\n\tF...
maximum-number-of-words-you-can-type
maximum-number-of-words-you-can-type__01__java
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nThere is a malfunctioning keyboard where some letter keys do not work. All...
add-minimum-number-of-rungs
add-minimum-number-of-rungs__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 strictly increasing integer array rungs that represents th...
maximum-number-of-points-with-cost
maximum-number-of-points-with-cost__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 m x n integer matrix points (0-indexed). Starting with 0 ...
maximum-genetic-difference-query
maximum-genetic-difference-query__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 rooted tree consisting of n nodes numbered 0 to n - 1. Each nod...
longest-common-subsequence-between-sorted-arrays
longest-common-subsequence-between-sorted-arrays__01__java
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven an array of integer arrays arrays where each arrays[i] is sorted in ...
check-if-all-characters-have-equal-number-of-occurrences
check-if-all-characters-have-equal-number-of-occurrences__01__java
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven a string s, return true if s is a good string, or false otherwise.\n...
the-number-of-the-smallest-unoccupied-chair
the-number-of-the-smallest-unoccupied-chair__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 is a party where n friends numbered from 0 to n - 1 are attending. T...
describe-the-painting
describe-the-painting__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 long and thin painting that can be represented by a number line...
number-of-visible-people-in-a-queue
number-of-visible-people-in-a-queue__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 standing in a queue, and they numbered from 0 to n - 1 ...
sum-of-digits-of-string-after-convert
sum-of-digits-of-string-after-convert__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a string s consisting of lowercase English letters, and an i...
largest-number-after-mutating-substring
largest-number-after-mutating-substring__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 num, which represents a large integer. You are also...
maximum-compatibility-score-sum
maximum-compatibility-score-sum__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\nThere is a survey that consists of n questions where each question's answe...
delete-duplicate-folders-in-system
delete-duplicate-folders-in-system__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\nDue to a bug, there are many duplicate folders in a file system. You are g...
maximum-of-minimum-values-in-all-subarrays
maximum-of-minimum-values-in-all-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\nYou are given an integer array nums of size n. You are asked to solve n qu...
three-divisors
three-divisors__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 n has exactly three positive divisors. ...
three-divisors
three-divisors__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 an integer n, return true if n has exactly three positive divisors. ...
maximum-number-of-weeks-for-which-you-can-work
maximum-number-of-weeks-for-which-you-can-work__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 projects numbered from 0 to n - 1. You are given an integer ar...
minimum-garden-perimeter-to-collect-enough-apples
minimum-garden-perimeter-to-collect-enough-apples__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\nIn a garden represented as an infinite 2D grid, there is an apple tree pla...
minimum-garden-perimeter-to-collect-enough-apples
minimum-garden-perimeter-to-collect-enough-apples__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\nIn a garden represented as an infinite 2D grid, there is an apple tree pla...
count-number-of-special-subsequences
count-number-of-special-subsequences__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 sequence is special if it consists of a positive number of 0s, followed ...
count-number-of-special-subsequences
count-number-of-special-subsequences__02__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nA sequence is special if it consists of a positive number of 0s, followed ...
minimum-time-for-k-virus-variants-to-spread
minimum-time-for-k-virus-variants-to-spread__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 n unique virus variants in an infinite 2D grid. You are given a ...
delete-characters-to-make-fancy-string
delete-characters-to-make-fancy-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\nA fancy string is a string where no three consecutive characters are equal...
check-if-move-is-legal
check-if-move-is-legal__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 8 x 8 grid board, where board[r][c] represents t...
minimum-total-space-wasted-with-k-resizing-operations
minimum-total-space-wasted-with-k-resizing-operations__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 currently designing a dynamic array. You are given a 0-indexed int...
maximum-product-of-the-length-of-two-palindromic-substrings
maximum-product-of-the-length-of-two-palindromic-substrings__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 string s and are tasked with finding two non-int...
check-if-string-is-a-prefix-of-array
check-if-string-is-a-prefix-of-array__01__java
Two Pointers
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven a string s and an array of strings words, determine whether s is a p...
remove-stones-to-minimize-the-total
remove-stones-to-minimize-the-total__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 piles, where piles[i] represents t...
minimum-number-of-swaps-to-make-the-string-balanced
minimum-number-of-swaps-to-make-the-string-balanced__01__java
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed string s of even length n. The string consists o...
find-the-longest-valid-obstacle-course-at-each-position
find-the-longest-valid-obstacle-course-at-each-position__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 want to build some obstacle courses. You are given a 0-indexed integer...
binary-searchable-numbers-in-an-unsorted-array
binary-searchable-numbers-in-an-unsorted-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\nConsider a function that implements an algorithm similar to Binary Search....
number-of-strings-that-appear-as-substrings-in-word
number-of-strings-that-appear-as-substrings-in-word__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 strings patterns and a string word, return the number of...
array-with-elements-not-equal-to-average-of-neighbors
array-with-elements-not-equal-to-average-of-neighbors__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 0-indexed array nums of distinct integers. You want to rea...
minimum-non-zero-product-of-the-array-elements
minimum-non-zero-product-of-the-array-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 a positive integer p. Consider an array nums (1-indexed) tha...
last-day-where-you-can-still-cross
last-day-where-you-can-still-cross__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 1-based binary matrix where 0 represents land and 1 represents ...
last-day-where-you-can-still-cross
last-day-where-you-can-still-cross__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\nThere is a 1-based binary matrix where 0 represents land and 1 represents ...
find-if-path-exists-in-graph
find-if-path-exists-in-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 a bi-directional graph with n vertices, where each vertex is labe...
find-if-path-exists-in-graph
find-if-path-exists-in-graph__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\nThere is a bi-directional graph with n vertices, where each vertex is labe...
find-if-path-exists-in-graph
find-if-path-exists-in-graph__03__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 bi-directional graph with n vertices, where each vertex is labe...
count-nodes-equal-to-sum-of-descendants
count-nodes-equal-to-sum-of-descendants__01__java
DFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven the root of a binary tree, return the number of nodes where the valu...
minimum-time-to-type-word-using-special-typewriter
minimum-time-to-type-word-using-special-typewriter__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 a special typewriter with lowercase English letters 'a' to 'z' ar...
maximum-matrix-sum
maximum-matrix-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 n x n integer matrix. You can do the following operation ...
number-of-ways-to-arrive-at-destination
number-of-ways-to-arrive-at-destination__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 in a city that consists of n intersections numbered from 0 to n - ...
number-of-ways-to-separate-numbers
number-of-ways-to-separate-numbers__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 wrote down many positive integers in a string called num. However, you...
find-greatest-common-divisor-of-array
find-greatest-common-divisor-of-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 integer array nums, return the greatest common divisor of the sma...
find-unique-binary-string
find-unique-binary-string__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\nGiven an array of strings nums containing n unique binary strings each of ...
find-unique-binary-string
find-unique-binary-string__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 array of strings nums containing n unique binary strings each of ...
minimize-the-difference-between-target-and-chosen-elements
minimize-the-difference-between-target-and-chosen-elements__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 m x n integer matrix mat and an integer target.\n\nChoose...
find-array-given-subset-sums
find-array-given-subset-sums__01__java
Sorting
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer n representing the length of an unknown array tha...
find-array-given-subset-sums
find-array-given-subset-sums__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 an integer n representing the length of an unknown array tha...
widest-pair-of-indices-with-equal-range-sum
widest-pair-of-indices-with-equal-range-sum__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 binary arrays nums1 and nums2. Find the widest...
minimum-difference-between-highest-and-lowest-of-k-scores
minimum-difference-between-highest-and-lowest-of-k-scores__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 nums, where nums[i] represents the...
find-the-kth-largest-integer-in-the-array
find-the-kth-largest-integer-in-the-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\nYou are given an array of strings nums and an integer k. Each string in nu...
minimum-number-of-work-sessions-to-finish-the-tasks
minimum-number-of-work-sessions-to-finish-the-tasks__01__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nThere are n tasks assigned to you. The task times are represented as an in...
number-of-unique-good-subsequences
number-of-unique-good-subsequences__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 binary string binary. A subsequence of binary is considere...
maximum-number-of-people-that-can-be-caught-in-tag
maximum-number-of-people-that-can-be-caught-in-tag__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 playing a game of tag with your friends. In tag, people are divide...
find-the-middle-index-in-array
find-the-middle-index-in-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\nGiven a 0-indexed integer array nums, find the leftmost middleIndex (i.e.,...
find-all-groups-of-farmland
find-all-groups-of-farmland__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 land where a 0 represents a ...
operations-on-tree
operations-on-tree__01__java
DFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a tree with n nodes numbered from 0 to n - 1 in the form of ...
the-number-of-good-subsets
the-number-of-good-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 an integer array nums. We call a subset of nums good if its ...
count-special-quadruplets
count-special-quadruplets__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 0-indexed integer array nums, return the number of distinct quadru...
count-special-quadruplets
count-special-quadruplets__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 a 0-indexed integer array nums, return the number of distinct quadru...
count-special-quadruplets
count-special-quadruplets__03__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 0-indexed integer array nums, return the number of distinct quadru...
the-number-of-weak-characters-in-the-game
the-number-of-weak-characters-in-the-game__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 playing a game that contains multiple characters, and each of the ...
first-day-where-you-have-been-in-all-the-rooms
first-day-where-you-have-been-in-all-the-rooms__01__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nThere are n rooms you need to visit, labeled from 0 to n - 1. Each day is ...
gcd-sort-of-an-array
gcd-sort-of-an-array__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 array nums, and you can perform the following ope...
smallest-greater-multiple-made-of-two-digits
smallest-greater-multiple-made-of-two-digits__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 three integers, k, digit1, and digit2, you want to find the smallest...
reverse-prefix-of-word
reverse-prefix-of-word__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 0-indexed string word and a character ch, reverse the segment of w...
number-of-pairs-of-interchangeable-rectangles
number-of-pairs-of-interchangeable-rectangles__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 n rectangles represented by a 0-indexed 2D integer array rec...
maximum-product-of-the-length-of-two-palindromic-subsequences
maximum-product-of-the-length-of-two-palindromic-subsequences__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, find two disjoint palindromic subsequences of s such tha...
smallest-missing-genetic-value-in-each-subtree
smallest-missing-genetic-value-in-each-subtree__01__java
DFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nThere is a family tree rooted at 0 consisting of n nodes numbered 0 to n -...
subtree-removal-game-with-fibonacci-tree
subtree-removal-game-with-fibonacci-tree__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 Fibonacci tree is a binary tree created using the order function order(n...
count-number-of-pairs-with-absolute-difference-k
count-number-of-pairs-with-absolute-difference-k__01__java
Brute Force
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums and an integer k, return the number of pairs (...
count-number-of-pairs-with-absolute-difference-k
count-number-of-pairs-with-absolute-difference-k__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 integer array nums and an integer k, return the number of pairs (...
find-original-array-from-doubled-array
find-original-array-from-doubled-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\nAn integer array original is transformed into a doubled array changed by a...
maximum-earnings-from-taxi
maximum-earnings-from-taxi__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\nThere are n points on a road you are driving your taxi on. The n points on...