slug stringlengths 3 79 | solution_id stringlengths 13 89 | primary_algorithm stringclasses 22
values | verified null | messages listlengths 3 3 |
|---|---|---|---|---|
minimum-suffix-flips | minimum-suffix-flips__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 binary string target of length n. You have anoth... |
number-of-good-leaf-nodes-pairs | number-of-good-leaf-nodes-pairs__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\nYou are given the root of a binary tree and an integer distance. A pair of... |
string-compression-ii | string-compression-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\nRun-length encoding is a string compression method that works by replacing... |
find-the-index-of-the-large-integer | find-the-index-of-the-large-integer__01__java | Binary Search | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nWe have an integer array arr, where all the integers in arr are equal exce... |
count-good-triplets | count-good-triplets__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 array of integers arr, and three integers a, b and c. You need to... |
find-the-winner-of-an-array-game | find-the-winner-of-an-array-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\nGiven an integer array arr of distinct integers and an integer k.\n\nA gam... |
minimum-swaps-to-arrange-a-binary-grid | minimum-swaps-to-arrange-a-binary-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\nGiven an n x n binary grid, in one step you can choose two adjacent rows o... |
get-the-maximum-score | get-the-maximum-score__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 sorted arrays of distinct integers nums1 and nums2.\n\nA... |
guess-the-majority-in-a-hidden-array | guess-the-majority-in-a-hidden-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\nWe have an integer array nums, where all the integers in nums are 0 or 1. ... |
kth-missing-positive-number | kth-missing-positive-number__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 arr of positive integers sorted in a strictly increasing or... |
can-convert-string-in-k-moves | can-convert-string-in-k-moves__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 strings s and t, your goal is to convert s into t in k moves or ... |
minimum-insertions-to-balance-a-parentheses-string | minimum-insertions-to-balance-a-parentheses-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\nGiven a parentheses string s containing only the characters '(' and ')'. A... |
find-longest-awesome-substring | find-longest-awesome-substring__01__java | Bit Manipulation | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a string s. An awesome substring is a non-empty substring of... |
make-the-string-great | make-the-string-great__01__java | String | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven a string s of lower and upper case English letters.\n\nA good string... |
find-kth-bit-in-nth-binary-string | find-kth-bit-in-nth-binary-string__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 two positive integers n and k, the binary string Sn is formed as fol... |
maximum-number-of-non-overlapping-subarrays-with-sum-equals-target | maximum-number-of-non-overlapping-subarrays-with-sum-equals-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 nums and an integer target, return the maximum number of no... |
minimum-cost-to-cut-a-stick | minimum-cost-to-cut-a-stick__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 wooden stick of length n units. The stick is labelled from 0 to n.... |
minimum-cost-to-cut-a-stick | minimum-cost-to-cut-a-stick__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 a wooden stick of length n units. The stick is labelled from 0 to n.... |
the-most-similar-path-in-a-graph | the-most-similar-path-in-a-graph__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\nWe have n cities and m bi-directional roads where roads[i] = [ai, bi] conn... |
three-consecutive-odds | three-consecutive-odds__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 arr, return true if there are three consecutive odd... |
three-consecutive-odds | three-consecutive-odds__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 arr, return true if there are three consecutive odd... |
minimum-operations-to-make-array-equal | minimum-operations-to-make-array-equal__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 an array arr of length n where arr[i] = (2 * i) + 1 for all valid... |
magnetic-force-between-two-balls | magnetic-force-between-two-balls__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 the universe Earth C-137, Rick discovered a special form of magnetic fo... |
minimum-number-of-days-to-eat-n-oranges | minimum-number-of-days-to-eat-n-oranges__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 oranges in the kitchen and you decided to eat some of these or... |
strings-differ-by-one-character | strings-differ-by-one-character__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 strings dict where all the strings are of the same length.... |
thousand-separator | thousand-separator__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 an integer n, add a dot (\".\") as the thousands separator and retur... |
minimum-number-of-vertices-to-reach-all-nodes | minimum-number-of-vertices-to-reach-all-nodes__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\nGiven a directed acyclic graph, with n vertices numbered from 0 to n-1, an... |
minimum-numbers-of-function-calls-to-make-target-array | minimum-numbers-of-function-calls-to-make-target-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 an integer array nums. You have an integer array arr of the ... |
detect-cycles-in-2d-grid | detect-cycles-in-2d-grid__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 a 2D array of characters grid of size m x n, you need to find if the... |
detect-cycles-in-2d-grid | detect-cycles-in-2d-grid__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 a 2D array of characters grid of size m x n, you need to find if the... |
most-visited-sector-in-a-circular-track | most-visited-sector-in-a-circular-track__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 n and an integer array rounds. We have a circular track w... |
maximum-number-of-coins-you-can-get | maximum-number-of-coins-you-can-get__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 3n piles of coins of varying size, you and your friends will tak... |
find-latest-group-of-size-m | find-latest-group-of-size-m__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 arr that represents a permutation of numbers from 1 to n.\n... |
find-latest-group-of-size-m | find-latest-group-of-size-m__02__java | Binary Search | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven an array arr that represents a permutation of numbers from 1 to n.\n... |
stone-game-v | stone-game-v__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 several stones arranged in a row, and each stone has an associat... |
put-boxes-into-the-warehouse-i | put-boxes-into-the-warehouse-i__01__java | Greedy | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given two arrays of positive integers, boxes and warehouse, repres... |
detect-pattern-of-length-m-repeated-k-or-more-times | detect-pattern-of-length-m-repeated-k-or-more-times__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 array of positive integers arr, find a pattern of length m that i... |
maximum-length-of-subarray-with-positive-product | maximum-length-of-subarray-with-positive-product__01__java | Dynamic Programming | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven an array of integers nums, find the maximum length of a subarray whe... |
maximum-length-of-subarray-with-positive-product | maximum-length-of-subarray-with-positive-product__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 of integers nums, find the maximum length of a subarray whe... |
minimum-number-of-days-to-disconnect-island | minimum-number-of-days-to-disconnect-island__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 binary grid grid where 1 represents land and 0 repr... |
number-of-ways-to-reorder-array-to-get-same-bst | number-of-ways-to-reorder-array-to-get-same-bst__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 an array nums that represents a permutation of integers from 1 to n.... |
dot-product-of-two-sparse-vectors | dot-product-of-two-sparse-vectors__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 sparse vectors, compute their dot product.\n\nImplement class Sp... |
matrix-diagonal-sum | matrix-diagonal-sum__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 square matrix mat, return the sum of the matrix diagonals.\n\nOnly... |
number-of-ways-to-split-a-string | number-of-ways-to-split-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 binary string s, you can split s into 3 non-empty strings s1, s2, ... |
shortest-subarray-to-be-removed-to-make-array-sorted | shortest-subarray-to-be-removed-to-make-array-sorted__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 arr, remove a subarray (can be empty) from arr such... |
shortest-subarray-to-be-removed-to-make-array-sorted | shortest-subarray-to-be-removed-to-make-array-sorted__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 integer array arr, remove a subarray (can be empty) from arr such... |
count-all-possible-routes | count-all-possible-routes__01__java | Memoization | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an array of distinct positive integers locations where locat... |
count-all-possible-routes | count-all-possible-routes__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 distinct positive integers locations where locat... |
replace-all-s-to-avoid-consecutive-repeating-characters | replace-all-s-to-avoid-consecutive-repeating-characters__01__java | String | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven a string s containing only lowercase English letters and the '?' cha... |
number-of-ways-where-square-of-number-is-equal-to-product-of-two-numbers | number-of-ways-where-square-of-number-is-equal-to-product-of-two-numbers__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 arrays of integers nums1 and nums2, return the number of triplet... |
number-of-ways-where-square-of-number-is-equal-to-product-of-two-numbers | number-of-ways-where-square-of-number-is-equal-to-product-of-two-numbers__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 two arrays of integers nums1 and nums2, return the number of triplet... |
minimum-time-to-make-rope-colorful | minimum-time-to-make-rope-colorful__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 has n balloons arranged on a rope. You are given a 0-indexed string ... |
remove-max-number-of-edges-to-keep-graph-fully-traversable | remove-max-number-of-edges-to-keep-graph-fully-traversable__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\nAlice and Bob have an undirected graph of n nodes and three types of edges... |
put-boxes-into-the-warehouse-ii | put-boxes-into-the-warehouse-ii__01__java | Greedy | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given two arrays of positive integers, boxes and warehouse, repres... |
special-positions-in-a-binary-matrix | special-positions-in-a-binary-matrix__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 m x n binary matrix mat, return the number of special positions i... |
count-unhappy-friends | count-unhappy-friends__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 list of preferences for n friends, where n is always even.... |
min-cost-to-connect-all-points | min-cost-to-connect-all-points__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 array points representing integer coordinates of some poi... |
min-cost-to-connect-all-points | min-cost-to-connect-all-points__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\nYou are given an array points representing integer coordinates of some poi... |
check-if-string-is-transformable-with-substring-sort-operations | check-if-string-is-transformable-with-substring-sort-operations__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 strings s and t, transform string s into string t using the foll... |
binary-search-tree-iterator-ii | binary-search-tree-iterator-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\nImplement the BSTIterator class that represents an iterator over the in-or... |
sum-of-all-odd-length-subarrays | sum-of-all-odd-length-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 array of positive integers arr, return the sum of all possible od... |
sum-of-all-odd-length-subarrays | sum-of-all-odd-length-subarrays__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 of positive integers arr, return the sum of all possible od... |
maximum-sum-obtained-of-any-permutation | maximum-sum-obtained-of-any-permutation__01__java | Greedy | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nWe have an array of integers, nums, and an array of requests where request... |
make-sum-divisible-by-p | make-sum-divisible-by-p__01__java | Hash Table | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven an array of positive integers nums, remove the smallest subarray (po... |
strange-printer-ii | strange-printer-ii__01__java | Graph | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nThere is a strange printer with the following two special requirements:\n\... |
rearrange-spaces-between-words | rearrange-spaces-between-words__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 text of words that are placed among some number of ... |
split-a-string-into-the-max-number-of-unique-substrings | split-a-string-into-the-max-number-of-unique-substrings__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 a string s, return the maximum number of unique substrings that the ... |
maximum-non-negative-product-in-a-matrix | maximum-non-negative-product-in-a-matrix__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 m x n matrix grid. Initially, you are located at the top-l... |
minimum-cost-to-connect-two-groups-of-points | minimum-cost-to-connect-two-groups-of-points__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 groups of points where the first group has size1 points,... |
minimum-cost-to-connect-two-groups-of-points | minimum-cost-to-connect-two-groups-of-points__02__java | Dynamic Programming | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given two groups of points where the first group has size1 points,... |
build-binary-expression-tree-from-infix-expression | build-binary-expression-tree-from-infix-expression__01__java | String | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nA binary expression tree is a kind of binary tree used to represent arithm... |
crawler-log-folder | crawler-log-folder__01__java | Array | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nThe Leetcode file system keeps a log each time some user performs a change... |
maximum-profit-of-operating-a-centennial-wheel | maximum-profit-of-operating-a-centennial-wheel__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 the operator of a Centennial Wheel that has four gondolas, and eac... |
throne-inheritance | throne-inheritance__01__java | DFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nA kingdom consists of a king, his children, his grandchildren, and so on. ... |
maximum-number-of-achievable-transfer-requests | maximum-number-of-achievable-transfer-requests__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\nWe have n buildings numbered from 0 to n - 1. Each building has a number o... |
find-nearest-right-node-in-binary-tree | find-nearest-right-node-in-binary-tree__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 the root of a binary tree and a node u in the tree, return the neare... |
find-nearest-right-node-in-binary-tree | find-nearest-right-node-in-binary-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 tree and a node u in the tree, return the neare... |
design-parking-system | design-parking-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\nDesign a parking system for a parking lot. The parking lot has three kinds... |
alert-using-same-key-card-three-or-more-times-in-a-one-hour-period | alert-using-same-key-card-three-or-more-times-in-a-one-hour-period__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\nLeetCode company workers use key-cards to unlock office doors. Each time a... |
find-valid-matrix-given-row-and-column-sums | find-valid-matrix-given-row-and-column-sums__01__java | Greedy | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given two arrays rowSum and colSum of non-negative integers where ... |
find-servers-that-handled-most-number-of-requests | find-servers-that-handled-most-number-of-requests__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 k servers numbered from 0 to k-1 that are being used to handle mu... |
special-array-with-x-elements-greater-than-or-equal-x | special-array-with-x-elements-greater-than-or-equal-x__01__java | Brute Force | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an array nums of non-negative integers. nums is considered s... |
special-array-with-x-elements-greater-than-or-equal-x | special-array-with-x-elements-greater-than-or-equal-x__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 an array nums of non-negative integers. nums is considered s... |
even-odd-tree | even-odd-tree__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 binary tree is named Even-Odd if it meets the following conditions:\n\n\... |
even-odd-tree | even-odd-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\nA binary tree is named Even-Odd if it meets the following conditions:\n\n\... |
maximum-number-of-visible-points | maximum-number-of-visible-points__01__java | Sliding Window | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an array points, an integer angle, and your location, where ... |
minimum-one-bit-operations-to-make-integers-zero | minimum-one-bit-operations-to-make-integers-zero__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 n, you must transform it into 0 using the following opera... |
check-if-two-expression-trees-are-equivalent | check-if-two-expression-trees-are-equivalent__01__java | DFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nA binary expression tree is a kind of binary tree used to represent arithm... |
check-if-two-expression-trees-are-equivalent | check-if-two-expression-trees-are-equivalent__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\nA binary expression tree is a kind of binary tree used to represent arithm... |
maximum-nesting-depth-of-the-parentheses | maximum-nesting-depth-of-the-parentheses__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 parentheses string s, return the nesting depth of s. The nes... |
maximal-network-rank | maximal-network-rank__01__java | Graph | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nThere is an infrastructure of n cities with some number of roads connectin... |
split-two-strings-to-make-palindrome | split-two-strings-to-make-palindrome__01__java | Two Pointers | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given two strings a and b of the same length. Choose an index and ... |
count-subtrees-with-max-distance-between-cities | count-subtrees-with-max-distance-between-cities__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 cities numbered from 1 to n. You are given an array edges of s... |
count-subtrees-with-max-distance-between-cities | count-subtrees-with-max-distance-between-cities__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 cities numbered from 1 to n. You are given an array edges of s... |
maximum-font-to-fit-a-sentence-in-a-screen | maximum-font-to-fit-a-sentence-in-a-screen__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 string text. We want to display text on a screen of width ... |
mean-of-array-after-removing-some-elements | mean-of-array-after-removing-some-elements__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 arr, return the mean of the remaining integers afte... |
coordinate-with-maximum-network-quality | coordinate-with-maximum-network-quality__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 array of network towers towers, where towers[i] = [xi, yi... |
number-of-sets-of-k-non-overlapping-line-segments | number-of-sets-of-k-non-overlapping-line-segments__01__java | Dynamic Programming | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven n points on a 1-D plane, where the ith point (from 0 to n-1) is at x... |
fancy-sequence | fancy-sequence__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\nWrite an API that generates fancy sequences using the append, addAll, and ... |
largest-substring-between-two-equal-characters | largest-substring-between-two-equal-characters__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 length of the longest substring between two e... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.