slug stringlengths 3 79 | solution_id stringlengths 13 89 | primary_algorithm stringclasses 22
values | verified null | messages listlengths 3 3 |
|---|---|---|---|---|
kth-largest-sum-in-a-binary-tree | kth-largest-sum-in-a-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\nYou are given the root of a binary tree and a positive integer k.\n\nThe l... |
kth-largest-sum-in-a-binary-tree | kth-largest-sum-in-a-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\nYou are given the root of a binary tree and a positive integer k.\n\nThe l... |
split-the-array-to-make-coprime-products | split-the-array-to-make-coprime-products__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 nums of length n.\n\nA split at an... |
number-of-ways-to-earn-points | number-of-ways-to-earn-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\nThere is a test that has n types of questions. You are given an integer ta... |
count-the-number-of-vowel-strings-in-range | count-the-number-of-vowel-strings-in-range__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 string words and two integers left and ... |
rearrange-array-to-maximize-prefix-score | rearrange-array-to-maximize-prefix-score__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. You can rearrange the elemen... |
count-the-number-of-beautiful-subarrays | count-the-number-of-beautiful-subarrays__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 can:\n... |
minimum-time-to-complete-all-tasks | minimum-time-to-complete-all-tasks__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 computer that can run an unlimited number of tasks at the same ... |
design-a-todo-list | design-a-todo-list__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\nDesign a Todo List Where users can add tasks, mark them as complete, or ge... |
distribute-money-to-maximum-children | distribute-money-to-maximum-children__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 money denoting the amount of money (in dollars) t... |
maximize-greatness-of-an-array | maximize-greatness-of-an-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. You are allowed to permute n... |
find-score-of-an-array-after-marking-all-elements | find-score-of-an-array-after-marking-all-elements__01__java | Heap | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an array nums consisting of positive integers.\n\nStarting w... |
find-score-of-an-array-after-marking-all-elements | find-score-of-an-array-after-marking-all-elements__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 array nums consisting of positive integers.\n\nStarting w... |
minimum-time-to-repair-cars | minimum-time-to-repair-cars__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 ranks representing the ranks of some mechan... |
number-of-even-and-odd-bits | number-of-even-and-odd-bits__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 positive integer n.\n\nLet even denote the number of even ... |
number-of-even-and-odd-bits | number-of-even-and-odd-bits__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\nYou are given a positive integer n.\n\nLet even denote the number of even ... |
check-knight-tour-configuration | check-knight-tour-configuration__01__java | Math | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nThere is a knight on an n x n chessboard. In a valid configuration, the kn... |
the-number-of-beautiful-subsets | the-number-of-beautiful-subsets__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 array nums of positive integers and a positive integer k.... |
smallest-missing-non-negative-integer-after-operations | smallest-missing-non-negative-integer-after-operations__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 and an integer value.\n\nIn o... |
make-the-prefix-sum-non-negative | make-the-prefix-sum-non-negative__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. You can apply the following ... |
k-items-with-the-maximum-sum | k-items-with-the-maximum-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\nThere is a bag that consists of items, each item has a number 1, 0, or -1 ... |
prime-subtraction-operation | prime-subtraction-operation__01__java | Binary Search | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed integer array nums of length n.\n\nYou can perfo... |
minimum-operations-to-make-all-array-elements-equal | minimum-operations-to-make-all-array-elements-equal__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 array nums consisting of positive integers.\n\nYou are al... |
collect-coins-in-a-tree | collect-coins-in-a-tree__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 exists an undirected and unrooted tree with n nodes indexed from 0 t... |
minimum-time-to-eat-all-grains | minimum-time-to-eat-all-grains__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 are n hens and m grains on a line. You are given the initial positio... |
form-smallest-number-from-two-digit-arrays | form-smallest-number-from-two-digit-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 two arrays of unique digits nums1 and nums2, return the smallest num... |
form-smallest-number-from-two-digit-arrays | form-smallest-number-from-two-digit-arrays__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 unique digits nums1 and nums2, return the smallest num... |
form-smallest-number-from-two-digit-arrays | form-smallest-number-from-two-digit-arrays__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 two arrays of unique digits nums1 and nums2, return the smallest num... |
find-the-substring-with-maximum-cost | find-the-substring-with-maximum-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 a string s, a string chars of distinct characters and an int... |
find-the-substring-with-maximum-cost | find-the-substring-with-maximum-cost__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 string s, a string chars of distinct characters and an int... |
make-k-subarray-sums-equal | make-k-subarray-sums-equal__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 arr and an integer k. The array ar... |
shortest-cycle-in-a-graph | shortest-cycle-in-a-graph__01__java | BFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nThere is a bi-directional graph with n vertices, where each vertex is labe... |
shortest-cycle-in-a-graph | shortest-cycle-in-a-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-the-longest-balanced-substring-of-a-binary-string | find-the-longest-balanced-substring-of-a-binary-string__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 binary string s consisting only of zeroes and ones.\n\nA s... |
find-the-longest-balanced-substring-of-a-binary-string | find-the-longest-balanced-substring-of-a-binary-string__02__java | String | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a binary string s consisting only of zeroes and ones.\n\nA s... |
convert-an-array-into-a-2d-array-with-conditions | convert-an-array-into-a-2d-array-with-conditions__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 nums. You need to create a 2D array from nu... |
mice-and-cheese | mice-and-cheese__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 two mice and n different types of cheese, each type of cheese sh... |
mice-and-cheese | mice-and-cheese__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\nThere are two mice and n different types of cheese, each type of cheese sh... |
minimum-reverse-operations | minimum-reverse-operations__01__java | BFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer n and an integer p representing an array arr of l... |
beautiful-pairs | beautiful-pairs__01__java | Divide and Conquer | null | [
{
"role": "system",
"content": "You 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 of the same len... |
prime-in-diagonal | prime-in-diagonal__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 two-dimensional integer array nums.\n\nReturn th... |
sum-of-distances | sum-of-distances__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. There exists an array arr of... |
minimize-the-maximum-difference-of-pairs | minimize-the-maximum-difference-of-pairs__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 and an integer p. Find p pair... |
minimum-number-of-visited-cells-in-a-grid | minimum-number-of-visited-cells-in-a-grid__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 a 0-indexed m x n integer matrix grid. Your initial position... |
count-the-number-of-k-free-subsets | count-the-number-of-k-free-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, which contains distinct elements and ... |
find-the-width-of-columns-of-a-grid | find-the-width-of-columns-of-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 a 0-indexed m x n integer matrix grid. The width of a column... |
find-the-score-of-all-prefixes-of-an-array | find-the-score-of-all-prefixes-of-an-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\nWe define the conversion array conver of an array arr as follows:\n\n\tcon... |
cousins-in-binary-tree-ii | cousins-in-binary-tree-ii__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, replace the value of each node in the tre... |
cousins-in-binary-tree-ii | cousins-in-binary-tree-ii__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\nGiven the root of a binary tree, replace the value of each node in the tre... |
design-graph-with-shortest-path-calculator | design-graph-with-shortest-path-calculator__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 directed weighted graph that consists of n nodes numbered from ... |
row-with-maximum-ones | row-with-maximum-ones__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 m x n binary matrix mat, find the 0-indexed position of the row th... |
find-the-maximum-divisibility-score | find-the-maximum-divisibility-score__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 two integer arrays nums and divisors.\n\nThe divisibility sc... |
minimum-additions-to-make-valid-string | minimum-additions-to-make-valid-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 string word to which you can insert letters \"a\", \"b\" or \"c\" ... |
minimize-the-total-price-of-the-trips | minimize-the-total-price-of-the-trips__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 exists an undirected and unrooted tree with n nodes indexed from 0 t... |
color-the-triangle-red | color-the-triangle-red__01__java | Math | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer n. Consider an equilateral triangle of side lengt... |
calculate-delayed-arrival-time | calculate-delayed-arrival-time__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 positive integer arrivalTime denoting the arrival time of ... |
sum-multiples | sum-multiples__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 positive integer n, find the sum of all integers in the range [1, ... |
sum-multiples | sum-multiples__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 a positive integer n, find the sum of all integers in the range [1, ... |
sliding-subarray-beauty | sliding-subarray-beauty__01__java | Sliding Window | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven an integer array nums containing n integers, find the beauty of each... |
sliding-subarray-beauty | sliding-subarray-beauty__02__java | Heap | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven an integer array nums containing n integers, find the beauty of each... |
minimum-number-of-operations-to-make-all-array-elements-equal-to-1 | minimum-number-of-operations-to-make-all-array-elements-equal-to-1__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 nums consisting of positive integers. You ... |
find-maximal-uncovered-ranges | find-maximal-uncovered-ranges__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 which is the length of a 0-indexed array nums, ... |
maximum-sum-with-exactly-k-elements | maximum-sum-with-exactly-k-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 0-indexed integer array nums and an integer k. Your task i... |
find-the-prefix-common-array-of-two-arrays | find-the-prefix-common-array-of-two-arrays__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 two 0-indexed integer permutations A and B of length n.\n\nA... |
find-the-prefix-common-array-of-two-arrays | find-the-prefix-common-array-of-two-arrays__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\nYou are given two 0-indexed integer permutations A and B of length n.\n\nA... |
find-the-prefix-common-array-of-two-arrays | find-the-prefix-common-array-of-two-arrays__03__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 two 0-indexed integer permutations A and B of length n.\n\nA... |
maximum-number-of-fish-in-a-grid | maximum-number-of-fish-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 a 0-indexed 2D matrix grid of size m x n, where (r, c) repre... |
make-array-empty | make-array-empty__01__java | Sorting | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer array nums containing distinct numbers, and you c... |
determine-the-winner-of-a-bowling-game | determine-the-winner-of-a-bowling-game__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 0-indexed integer arrays player1 and player2, representi... |
first-completely-painted-row-or-column | first-completely-painted-row-or-column__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 arr, and an m x n integer matrix m... |
minimum-cost-of-a-path-with-special-roads | minimum-cost-of-a-path-with-special-roads__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 start where start = [startX, startY] represents you... |
lexicographically-smallest-beautiful-string | lexicographically-smallest-beautiful-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\nA string is beautiful if:\n\n\tIt consists of the first k letters of the E... |
the-knights-tour | the-knights-tour__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 two positive integers m and n which are the height and width of a 0-... |
find-the-distinct-difference-array | find-the-distinct-difference-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 array nums of length n.\n\nThe distinct differen... |
frequency-tracker | frequency-tracker__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 data structure that keeps track of the values in it and answers s... |
number-of-adjacent-elements-with-the-same-color | number-of-adjacent-elements-with-the-same-color__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 n representing an array colors of length n where ... |
make-costs-of-paths-equal-in-a-binary-tree | make-costs-of-paths-equal-in-a-binary-tree__01__java | Greedy | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer n representing the number of nodes in a perfect b... |
split-a-circular-linked-list | split-a-circular-linked-list__01__java | Two Pointers | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven a circular linked list list of positive integers, your task is to sp... |
number-of-senior-citizens | number-of-senior-citizens__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 array of strings details. Each element of detail... |
sum-in-a-matrix | sum-in-a-matrix__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 nums. Initially, your score is ... |
maximum-or | maximum-or__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 of length n and an integer k.... |
power-of-heroes | power-of-heroes__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 integer array nums representing the strength of ... |
find-the-losers-of-the-circular-game | find-the-losers-of-the-circular-game__01__java | Math | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nThere are n friends that are playing a game. The friends are sitting in a ... |
neighboring-bitwise-xor | neighboring-bitwise-xor__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 0-indexed array derived with length n is derived by computing the bitwis... |
maximum-number-of-moves-in-a-grid | maximum-number-of-moves-in-a-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\nYou are given a 0-indexed m x n matrix grid consisting of positive integer... |
count-the-number-of-complete-components | count-the-number-of-complete-components__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 vertices, ... |
extract-kth-character-from-the-rope-tree | extract-kth-character-from-the-rope-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 the root of a binary tree and an integer k. Besides the left... |
minimum-string-length-after-removing-substrings | minimum-string-length-after-removing-substrings__01__java | String | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a string s consisting only of uppercase English letters.\n\n... |
lexicographically-smallest-palindrome | lexicographically-smallest-palindrome__01__java | Greedy | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a string s consisting of lowercase English letters, and you ... |
find-the-punishment-number-of-an-integer | find-the-punishment-number-of-an-integer__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 a positive integer n, return the punishment number of n.\n\nThe puni... |
modify-graph-edge-weights | modify-graph-edge-weights__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 undirected weighted connected graph containing n nodes la... |
minimum-operations-to-make-numbers-non-positive | minimum-operations-to-make-numbers-non-positive__01__java | Binary Search | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed integer array nums and two integers x and y. In ... |
buy-two-chocolates | buy-two-chocolates__01__java | Sorting | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer array prices representing the prices of various c... |
buy-two-chocolates | buy-two-chocolates__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 are given an integer array prices representing the prices of various c... |
extra-characters-in-a-string | extra-characters-in-a-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 0-indexed string s and a dictionary of words dictionary. Y... |
extra-characters-in-a-string | extra-characters-in-a-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 0-indexed string s and a dictionary of words dictionary. Y... |
maximum-strength-of-a-group | maximum-strength-of-a-group__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 integer array nums representing the score of stu... |
maximum-strength-of-a-group | maximum-strength-of-a-group__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 are given a 0-indexed integer array nums representing the score of stu... |
greatest-common-divisor-traversal | greatest-common-divisor-traversal__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 0-indexed integer array nums, and you are allowed to trave... |
remove-trailing-zeros-from-a-string | remove-trailing-zeros-from-a-string__01__java | String | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven a positive integer num represented as a string, return the integer n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.