slug stringlengths 3 79 | solution_id stringlengths 13 89 | primary_algorithm stringclasses 22
values | verified null | messages listlengths 3 3 |
|---|---|---|---|---|
minimum-path-cost-in-a-grid | minimum-path-cost-in-a-grid__01__java | Dynamic Programming | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed m x n integer matrix grid consisting of distinct... |
fair-distribution-of-cookies | fair-distribution-of-cookies__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 an integer array cookies, where cookies[i] denotes the numbe... |
naming-a-company | naming-a-company__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 an array of strings ideas that represents a list of names to... |
check-for-contradictions-in-equations | check-for-contradictions-in-equations__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 2D array of strings equations and an array of real numbers... |
greatest-english-letter-in-upper-and-lower-case | greatest-english-letter-in-upper-and-lower-case__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 of English letters s, return the greatest English letter wh... |
greatest-english-letter-in-upper-and-lower-case | greatest-english-letter-in-upper-and-lower-case__02__java | Bit Manipulation | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven a string of English letters s, return the greatest English letter wh... |
sum-of-numbers-with-units-digit-k | sum-of-numbers-with-units-digit-k__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 integers num and k, consider a set of positive integers with the... |
sum-of-numbers-with-units-digit-k | sum-of-numbers-with-units-digit-k__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 two integers num and k, consider a set of positive integers with the... |
longest-binary-subsequence-less-than-or-equal-to-k | longest-binary-subsequence-less-than-or-equal-to-k__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 binary string s and a positive integer k.\n\nReturn the le... |
selling-pieces-of-wood | selling-pieces-of-wood__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 two integers m and n that represent the height and width of ... |
selling-pieces-of-wood | selling-pieces-of-wood__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 integers m and n that represent the height and width of ... |
minimum-flips-in-binary-tree-to-get-result | minimum-flips-in-binary-tree-to-get-result__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 the root of a binary tree with the following properties:\n\n... |
count-asterisks | count-asterisks__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, where every two consecutive vertical bars '|' ar... |
count-unreachable-pairs-of-nodes-in-an-undirected-graph | count-unreachable-pairs-of-nodes-in-an-undirected-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\nYou are given an integer n. There is an undirected graph with n nodes, num... |
maximum-xor-after-operations | maximum-xor-after-operations__01__java | Bit Manipulation | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed integer array nums. In one operation, select any... |
number-of-distinct-roll-sequences | number-of-distinct-roll-sequences__01__java | Dynamic Programming | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer n. You roll a fair 6-sided dice n times. Determin... |
check-if-matrix-is-x-matrix | check-if-matrix-is-x-matrix__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 matrix is said to be an X-Matrix if both of the following conditi... |
count-number-of-ways-to-place-houses | count-number-of-ways-to-place-houses__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 street with n * 2 plots, where there are n plots on each side o... |
maximum-score-of-spliced-array | maximum-score-of-spliced-array__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 0-indexed integer arrays nums1 and nums2, both of length... |
minimum-score-after-removals-on-a-tree | minimum-score-after-removals-on-a-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\nThere is an undirected connected tree with n nodes labeled from 0 to n - 1... |
find-minimum-time-to-finish-all-jobs-ii | find-minimum-time-to-finish-all-jobs-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 0-indexed integer arrays jobs and workers of equal lengt... |
decode-the-message | decode-the-message__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 the strings key and message, which represent a cipher key an... |
spiral-matrix-iv | spiral-matrix-iv__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 two integers m and n, which represent the dimensions of a ma... |
number-of-people-aware-of-a-secret | number-of-people-aware-of-a-secret__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 day 1, one person discovers a secret.\n\nYou are given an integer delay... |
number-of-increasing-paths-in-a-grid | number-of-increasing-paths-in-a-grid__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, where you can move from a cell... |
valid-palindrome-iv | valid-palindrome-iv__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 consisting of only lowercase English le... |
evaluate-boolean-binary-tree | evaluate-boolean-binary-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\nYou are given the root of a full binary tree with the following properties... |
the-latest-time-to-catch-a-bus | the-latest-time-to-catch-a-bus__01__java | Math | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed integer array buses of length n, where buses[i] ... |
minimum-sum-of-squared-difference | minimum-sum-of-squared-difference__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 positive 0-indexed integer arrays nums1 and nums2, both ... |
subarray-with-elements-greater-than-varying-threshold | subarray-with-elements-greater-than-varying-threshold__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 an integer threshold.\n\nFind any ... |
subarray-with-elements-greater-than-varying-threshold | subarray-with-elements-greater-than-varying-threshold__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 integer array nums and an integer threshold.\n\nFind any ... |
minimum-amount-of-time-to-fill-cups | minimum-amount-of-time-to-fill-cups__01__java | Greedy | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou have a water dispenser that can dispense cold, warm, and hot water. Ev... |
minimum-amount-of-time-to-fill-cups | minimum-amount-of-time-to-fill-cups__02__java | Greedy | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou have a water dispenser that can dispense cold, warm, and hot water. Ev... |
smallest-number-in-infinite-set | smallest-number-in-infinite-set__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 a set which contains all positive integers [1, 2, 3, 4, 5, ...].\... |
move-pieces-to-obtain-a-string | move-pieces-to-obtain-a-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\nYou are given two strings start and target, both of length n. Each string ... |
move-pieces-to-obtain-a-string | move-pieces-to-obtain-a-string__02__java | Two Pointers | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given two strings start and target, both of length n. Each string ... |
count-the-number-of-ideal-arrays | count-the-number-of-ideal-arrays__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 n and maxValue, which are used to describe an i... |
count-the-number-of-ideal-arrays | count-the-number-of-ideal-arrays__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 integers n and maxValue, which are used to describe an i... |
minimum-adjacent-swaps-to-make-a-valid-array | minimum-adjacent-swaps-to-make-a-valid-array__01__java | Greedy | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed integer array nums.\n\nSwaps of adjacent element... |
maximum-number-of-pairs-in-array | maximum-number-of-pairs-in-array__01__java | Hash Table | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed integer array nums. In one operation, you may do... |
max-sum-of-a-pair-with-equal-sum-of-digits | max-sum-of-a-pair-with-equal-sum-of-digits__01__java | Hash Table | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed array nums consisting of positive integers. You ... |
query-kth-smallest-trimmed-number | query-kth-smallest-trimmed-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\nYou are given a 0-indexed array of strings nums, where each string is of e... |
minimum-deletions-to-make-array-divisible | minimum-deletions-to-make-array-divisible__01__java | Sorting | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given two positive integer arrays nums and numsDivide. You can del... |
minimum-deletions-to-make-array-divisible | minimum-deletions-to-make-array-divisible__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 two positive integer arrays nums and numsDivide. You can del... |
finding-the-number-of-visible-mountains | finding-the-number-of-visible-mountains__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 2D integer array peaks where peaks[i] = [xi, yi]... |
best-poker-hand | best-poker-hand__01__java | Hash Table | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer array ranks and a character array suits. You have... |
number-of-zero-filled-subarrays | number-of-zero-filled-subarrays__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 number of subarrays filled with 0.... |
design-a-number-container-system | design-a-number-container-system__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\nDesign a number container system that can do the following:\n\n\tInsert or... |
shortest-impossible-sequence-of-rolls | shortest-impossible-sequence-of-rolls__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 rolls of length n and an integer k. You rol... |
first-letter-to-appear-twice | first-letter-to-appear-twice__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 consisting of lowercase English letters, return the first... |
first-letter-to-appear-twice | first-letter-to-appear-twice__02__java | Bit Manipulation | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven a string s consisting of lowercase English letters, return the first... |
equal-row-and-column-pairs | equal-row-and-column-pairs__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 n x n integer matrix grid, return the number of pairs (r... |
design-a-food-rating-system | design-a-food-rating-system__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\nDesign a food rating system that can do the following:\n\n\tModify the rat... |
number-of-excellent-pairs | number-of-excellent-pairs__01__java | Binary Search | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed positive integer array nums and a positive integ... |
maximum-number-of-books-you-can-take | maximum-number-of-books-you-can-take__01__java | Math | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed integer array books of length n where books[i] d... |
make-array-zero-by-subtracting-equal-amounts | make-array-zero-by-subtracting-equal-amounts__01__java | Hash Table | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a non-negative integer array nums. In one operation, you mus... |
maximum-number-of-groups-entering-a-competition | maximum-number-of-groups-entering-a-competition__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 array grades which represents the grades ... |
find-closest-node-to-given-two-nodes | find-closest-node-to-given-two-nodes__01__java | BFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a directed graph of n nodes numbered from 0 to n - 1, where ... |
longest-cycle-in-a-graph | longest-cycle-in-a-graph__01__java | DFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a directed graph of n nodes numbered from 0 to n - 1, where ... |
minimum-costs-using-the-train-line | minimum-costs-using-the-train-line__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 train line going through a city has two routes, the regular route and th... |
merge-similar-items | merge-similar-items__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 2D integer arrays, items1 and items2, representing two s... |
count-number-of-bad-pairs | count-number-of-bad-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\nYou are given a 0-indexed integer array nums. A pair of indices (i, j) is ... |
task-scheduler-ii | task-scheduler-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 0-indexed array of positive integers tasks, representing t... |
minimum-replacements-to-sort-the-array | minimum-replacements-to-sort-the-array__01__java | Greedy | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed integer array nums. In one operation you can rep... |
number-of-arithmetic-triplets | number-of-arithmetic-triplets__01__java | Brute Force | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed, strictly increasing integer array nums and a po... |
number-of-arithmetic-triplets | number-of-arithmetic-triplets__02__java | Hash Table | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed, strictly increasing integer array nums and a po... |
reachable-nodes-with-restrictions | reachable-nodes-with-restrictions__01__java | DFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nThere is an undirected tree with n nodes labeled from 0 to n - 1 and n - 1... |
reachable-nodes-with-restrictions | reachable-nodes-with-restrictions__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 an undirected tree with n nodes labeled from 0 to n - 1 and n - 1... |
check-if-there-is-a-valid-partition-for-the-array | check-if-there-is-a-valid-partition-for-the-array__01__java | Memoization | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed integer array nums. You have to partition the ar... |
check-if-there-is-a-valid-partition-for-the-array | check-if-there-is-a-valid-partition-for-the-array__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 a 0-indexed integer array nums. You have to partition the ar... |
longest-ideal-subsequence | longest-ideal-subsequence__01__java | Dynamic Programming | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a string s consisting of lowercase letters and an integer k.... |
minimize-maximum-value-in-a-grid | minimize-maximum-value-in-a-grid__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 m x n integer matrix grid containing distinct positive in... |
largest-local-values-in-a-matrix | largest-local-values-in-a-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\nYou are given an n x n integer matrix grid.\n\nGenerate an integer matrix ... |
node-with-highest-edge-score | node-with-highest-edge-score__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 a directed graph with n nodes labeled from 0 to n - 1, where... |
construct-smallest-number-from-di-string | construct-smallest-number-from-di-string__01__java | Greedy | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed string pattern of length n consisting of the cha... |
count-special-integers | count-special-integers__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 call a positive integer special if all of its digits are distinct.\n\nG... |
choose-edges-to-maximize-score-in-a-tree | choose-edges-to-maximize-score-in-a-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\nYou are given a weighted tree consisting of n nodes numbered from 0 to n -... |
minimum-recolors-to-get-k-consecutive-black-blocks | minimum-recolors-to-get-k-consecutive-black-blocks__01__java | Sliding Window | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed string blocks of length n, where blocks[i] is ei... |
time-needed-to-rearrange-a-binary-string | time-needed-to-rearrange-a-binary-string__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 s. In one second, all occurrences of \"01\" ... |
time-needed-to-rearrange-a-binary-string | time-needed-to-rearrange-a-binary-string__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 a binary string s. In one second, all occurrences of \"01\" ... |
shifting-letters-ii | shifting-letters-ii__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 string s of lowercase English letters and a 2D integer arr... |
maximum-segment-sum-after-removals | maximum-segment-sum-after-removals__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 0-indexed integer arrays nums and removeQueries, both of... |
minimum-hours-of-training-to-win-a-competition | minimum-hours-of-training-to-win-a-competition__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 entering a competition, and are given two positive integers initia... |
largest-palindromic-number | largest-palindromic-number__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 consisting of digits only.\n\nReturn the larges... |
amount-of-time-for-binary-tree-to-be-infected | amount-of-time-for-binary-tree-to-be-infected__01__java | DFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given the root of a binary tree with unique values, and an integer... |
find-the-k-sum-of-an-array | find-the-k-sum-of-an-array__01__java | Heap | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer array nums and a positive integer k. You can choo... |
median-of-a-row-wise-sorted-matrix | median-of-a-row-wise-sorted-matrix__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 m x n matrix grid containing an odd number of integers where each... |
longest-subsequence-with-limited-sum | longest-subsequence-with-limited-sum__01__java | Binary Search | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer array nums of length n, and an integer array quer... |
longest-subsequence-with-limited-sum | longest-subsequence-with-limited-sum__02__java | Two Pointers | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer array nums of length n, and an integer array quer... |
removing-stars-from-a-string | removing-stars-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\nYou are given a string s, which contains stars *.\n\nIn one operation, you... |
minimum-amount-of-time-to-collect-garbage | minimum-amount-of-time-to-collect-garbage__01__java | Hash Table | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed array of strings garbage where garbage[i] repres... |
build-a-matrix-with-conditions | build-a-matrix-with-conditions__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 a positive integer k. You are also given:\n\n\ta 2D integer ... |
count-strictly-increasing-subarrays | count-strictly-increasing-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\nYou are given an array nums consisting of positive integers.\n\nReturn the... |
find-subarrays-with-equal-sum | find-subarrays-with-equal-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\nGiven a 0-indexed integer array nums, determine whether there exist two su... |
strictly-palindromic-number | strictly-palindromic-number__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\nAn integer n is strictly palindromic if, for every base b between 2 and n ... |
maximum-rows-covered-by-columns | maximum-rows-covered-by-columns__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 an m x n binary matrix matrix and an integer numSelect.\n\nY... |
maximum-number-of-robots-within-budget | maximum-number-of-robots-within-budget__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 have n robots. You are given two 0-indexed integer arrays, chargeTimes... |
check-distances-between-same-letters | check-distances-between-same-letters__01__java | Hash Table | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed string s consisting of only lowercase English le... |
number-of-ways-to-reach-a-position-after-exactly-k-steps | number-of-ways-to-reach-a-position-after-exactly-k-steps__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 positive integers startPos and endPos. Initially, you ar... |
longest-nice-subarray | longest-nice-subarray__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 an array nums consisting of positive integers.\n\nWe call a ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.