slug stringlengths 3 79 | solution_id stringlengths 13 89 | primary_algorithm stringclasses 22
values | verified null | messages listlengths 3 3 |
|---|---|---|---|---|
find-first-palindromic-string-in-the-array | find-first-palindromic-string-in-the-array__01__java | Math | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven an array of strings words, return the first palindromic string in th... |
adding-spaces-to-a-string | adding-spaces-to-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 a 0-indexed string s and a 0-indexed integer array spaces th... |
number-of-smooth-descent-periods-of-a-stock | number-of-smooth-descent-periods-of-a-stock__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 integer array prices representing the daily price history... |
minimum-operations-to-make-the-array-k-increasing | minimum-operations-to-make-the-array-k-increasing__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 array arr consisting of n positive integers, and... |
elements-in-array-after-removing-and-replacing-elements | elements-in-array-after-removing-and-replacing-elements__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 integer array nums. Initially on minute 0, the a... |
maximum-number-of-words-found-in-sentences | maximum-number-of-words-found-in-sentences__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\nA sentence is a list of words that are separated by a single space with no... |
find-all-possible-recipes-from-given-supplies | find-all-possible-recipes-from-given-supplies__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 have information about n different recipes. You are given a string arr... |
check-if-a-parentheses-string-can-be-valid | check-if-a-parentheses-string-can-be-valid__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 parentheses string is a non-empty string consisting only of '(' and ')'.... |
abbreviating-the-product-of-a-range | abbreviating-the-product-of-a-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 two positive integers left and right with left <= right. Cal... |
a-number-after-a-double-reversal | a-number-after-a-double-reversal__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\nReversing an integer means to reverse all its digits.\n\n\tFor example, re... |
execution-of-all-suffix-instructions-staying-in-a-grid | execution-of-all-suffix-instructions-staying-in-a-grid__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\nThere is an n x n grid, with the top-left cell at (0, 0) and the bottom-ri... |
intervals-between-identical-elements | intervals-between-identical-elements__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 n integers arr.\n\nThe interval between... |
recover-the-original-array | recover-the-original-array__01__java | Two Pointers | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nAlice had a 0-indexed array arr consisting of n positive integers. She cho... |
minimum-operations-to-remove-adjacent-ones-in-matrix | minimum-operations-to-remove-adjacent-ones-in-matrix__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 binary matrix grid. In one operation, you can fl... |
check-if-all-as-appears-before-all-bs | check-if-all-as-appears-before-all-bs__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 consisting of only the characters 'a' and 'b', return tru... |
number-of-laser-beams-in-a-bank | number-of-laser-beams-in-a-bank__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\nAnti-theft security devices are activated inside a bank. You are given a 0... |
destroying-asteroids | destroying-asteroids__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 mass, which represents the original mass of a pla... |
maximum-employees-to-be-invited-to-a-meeting | maximum-employees-to-be-invited-to-a-meeting__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 company is organizing a meeting and has a list of n employees, waiting t... |
remove-all-ones-with-row-and-column-flips | remove-all-ones-with-row-and-column-flips__01__java | Hash Table | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an m x n binary matrix grid.\n\nIn one operation, you can ch... |
capitalize-the-title | capitalize-the-title__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 title consisting of one or more words separated by ... |
maximum-twin-sum-of-a-linked-list | maximum-twin-sum-of-a-linked-list__01__java | Math | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nIn a linked list of size n, where n is even, the ith node (0-indexed) of t... |
maximum-twin-sum-of-a-linked-list | maximum-twin-sum-of-a-linked-list__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\nIn a linked list of size n, where n is even, the ith node (0-indexed) of t... |
longest-palindrome-by-concatenating-two-letter-words | longest-palindrome-by-concatenating-two-letter-words__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 array of strings words. Each element of words consists of... |
stamping-the-grid | stamping-the-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\nYou are given an m x n binary matrix grid where each cell is either 0 (emp... |
check-if-every-row-and-column-contains-all-numbers | check-if-every-row-and-column-contains-all-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\nAn n x n matrix is valid if every row and every column contains all the in... |
minimum-swaps-to-group-all-1s-together-ii | minimum-swaps-to-group-all-1s-together-ii__01__java | Sliding Window | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nA swap is defined as taking two distinct positions in an array and swappin... |
count-words-obtained-after-adding-a-letter | count-words-obtained-after-adding-a-letter__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 arrays of strings startWords and targetWords. ... |
earliest-possible-day-of-full-bloom | earliest-possible-day-of-full-bloom__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 n flower seeds. Every seed must be planted first before it can be... |
pour-water-between-buckets-to-make-water-levels-equal | pour-water-between-buckets-to-make-water-levels-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 have n buckets each containing some gallons of water in it, represente... |
divide-a-string-into-groups-of-size-k | divide-a-string-into-groups-of-size-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\nA string s can be partitioned into groups of size k using the following pr... |
minimum-moves-to-reach-target-score | minimum-moves-to-reach-target-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 playing a game with integers. You start with the integer 1 and you... |
minimum-moves-to-reach-target-score | minimum-moves-to-reach-target-score__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 playing a game with integers. You start with the integer 1 and you... |
solving-questions-with-brainpower | solving-questions-with-brainpower__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 2D integer array questions where questions[i] = ... |
solving-questions-with-brainpower | solving-questions-with-brainpower__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 2D integer array questions where questions[i] = ... |
maximum-running-time-of-n-computers | maximum-running-time-of-n-computers__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 have n computers. You are given the integer n and a 0-indexed integer ... |
choose-numbers-from-two-arrays-in-range | choose-numbers-from-two-arrays-in-range__01__java | Dynamic Programming | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given two 0-indexed integer arrays nums1 and nums2 of length n.\n\... |
minimum-cost-of-buying-candies-with-discount | minimum-cost-of-buying-candies-with-discount__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 shop is selling candies at a discount. For every two candies sold, the s... |
count-the-hidden-sequences | count-the-hidden-sequences__01__java | Array | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed array of n integers differences, which describes... |
k-highest-ranked-items-within-a-price-range | k-highest-ranked-items-within-a-price-range__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 2D integer array grid of size m x n that represe... |
number-of-ways-to-divide-a-long-corridor | number-of-ways-to-divide-a-long-corridor__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\nAlong a long library corridor, there is a line of seats and decorative pla... |
number-of-ways-to-divide-a-long-corridor | number-of-ways-to-divide-a-long-corridor__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\nAlong a long library corridor, there is a line of seats and decorative pla... |
count-elements-with-strictly-smaller-and-greater-elements | count-elements-with-strictly-smaller-and-greater-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 nums, return the number of elements that have both ... |
rearrange-array-elements-by-sign | rearrange-array-elements-by-sign__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 integer array nums of even length consisting of ... |
find-all-lonely-numbers-in-the-array | find-all-lonely-numbers-in-the-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 an integer array nums. A number x is lonely when it appears ... |
maximum-good-people-based-on-statements | maximum-good-people-based-on-statements__01__java | Backtracking | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nThere are two types of persons:\n\n\tThe good person: The person who alway... |
minimum-number-of-lines-to-cover-points | minimum-number-of-lines-to-cover-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 an array points where points[i] = [xi, yi] represents a poin... |
keep-multiplying-found-values-by-two | keep-multiplying-found-values-by-two__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 array of integers nums. You are also given an integer ori... |
all-divisions-with-the-highest-score-of-a-binary-array | all-divisions-with-the-highest-score-of-a-binary-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\nYou are given a 0-indexed binary array nums of length n. nums can be divid... |
find-substring-with-given-hash-value | find-substring-with-given-hash-value__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\nThe hash of a 0-indexed string s of length k, given integers p and m, is c... |
groups-of-strings | groups-of-strings__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 array of strings words. Each string consists of ... |
amount-of-new-area-painted-each-day | amount-of-new-area-painted-each-day__01__java | Array | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nThere is a long and thin painting that can be represented by a number line... |
minimum-sum-of-four-digit-number-after-splitting-digits | minimum-sum-of-four-digit-number-after-splitting-digits__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 num consisting of exactly four digits. Sp... |
partition-array-according-to-given-pivot | partition-array-according-to-given-pivot__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 and an integer pivot. Rearran... |
minimum-cost-to-set-cooking-time | minimum-cost-to-set-cooking-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\nA generic microwave supports cooking times for:\n\n\tat least 1 second.\n\... |
minimum-difference-in-sums-after-removal-of-elements | minimum-difference-in-sums-after-removal-of-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 a 0-indexed integer array nums consisting of 3 * n elements.... |
sort-even-and-odd-indices-independently | sort-even-and-odd-indices-independently__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. Rearrange the values of nums... |
smallest-value-of-the-rearranged-number | smallest-value-of-the-rearranged-number__01__java | Sorting | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer num. Rearrange the digits of num such that its va... |
design-bitset | design-bitset__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\nA Bitset is a data structure that compactly stores bits.\n\nImplement the ... |
minimum-time-to-remove-all-cars-containing-illegal-goods | minimum-time-to-remove-all-cars-containing-illegal-goods__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 binary string s which represents a sequence of t... |
unique-substrings-with-equal-digit-frequency | unique-substrings-with-equal-digit-frequency__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 digit string s, return the number of unique substrings of s where ... |
count-operations-to-obtain-zero | count-operations-to-obtain-zero__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 non-negative integers num1 and num2.\n\nIn one operation... |
count-operations-to-obtain-zero | count-operations-to-obtain-zero__03__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 non-negative integers num1 and num2.\n\nIn one operation... |
minimum-operations-to-make-the-array-alternating | minimum-operations-to-make-the-array-alternating__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 array nums consisting of n positive integers.\n\... |
removing-minimum-number-of-magic-beans | removing-minimum-number-of-magic-beans__01__java | Sorting | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an array of positive integers beans, where each integer repr... |
maximum-and-sum-of-array | maximum-and-sum-of-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 an integer array nums of length n and an integer numSlots su... |
remove-all-ones-with-row-and-column-flips-ii | remove-all-ones-with-row-and-column-flips-ii__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 binary matrix grid.\n\nIn one operation, y... |
count-equal-and-divisible-pairs-in-an-array | count-equal-and-divisible-pairs-in-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\nGiven a 0-indexed integer array nums of length n and an integer k, return ... |
find-three-consecutive-integers-that-sum-to-a-given-number | find-three-consecutive-integers-that-sum-to-a-given-number__01__java | Math | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven an integer num, return three consecutive integers (as a sorted array... |
maximum-split-of-positive-even-integers | maximum-split-of-positive-even-integers__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 finalSum. Split it into a sum of a maximum number... |
count-good-triplets-in-an-array | count-good-triplets-in-an-array__01__java | Binary Search | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given two 0-indexed arrays nums1 and nums2 of length n, both of wh... |
count-good-triplets-in-an-array | count-good-triplets-in-an-array__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 two 0-indexed arrays nums1 and nums2 of length n, both of wh... |
count-integers-with-even-digit-sum | count-integers-with-even-digit-sum__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 num, return the number of positive integers less ... |
count-integers-with-even-digit-sum | count-integers-with-even-digit-sum__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 num, return the number of positive integers less ... |
merge-nodes-in-between-zeros | merge-nodes-in-between-zeros__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 the head of a linked list, which contains a series of intege... |
construct-string-with-repeat-limit | construct-string-with-repeat-limit__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 and an integer repeatLimit. Construct a new strin... |
count-array-pairs-divisible-by-k | count-array-pairs-divisible-by-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 a 0-indexed integer array nums of length n and an integer k, return ... |
number-of-ways-to-build-sturdy-brick-wall | number-of-ways-to-build-sturdy-brick-wall__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 integers height and width which specify the dimensions of a ... |
counting-words-with-a-given-prefix | counting-words-with-a-given-prefix__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 strings words and a string pref.\n\nReturn the n... |
counting-words-with-a-given-prefix | counting-words-with-a-given-prefix__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\nYou are given an array of strings words and a string pref.\n\nReturn the n... |
minimum-number-of-steps-to-make-two-strings-anagram-ii | minimum-number-of-steps-to-make-two-strings-anagram-ii__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 strings s and t. In one step, you can append any charact... |
minimum-time-to-complete-trips | minimum-time-to-complete-trips__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 time where time[i] denotes the time taken by the it... |
minimum-time-to-finish-the-race | minimum-time-to-finish-the-race__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 2D integer array tires where tires[i] = [fi, ri]... |
number-of-ways-to-build-house-of-cards | number-of-ways-to-build-house-of-cards__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 integer n representing the number of playing cards you ha... |
most-frequent-number-following-key-in-an-array | most-frequent-number-following-key-in-an-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. You are also given an intege... |
sort-the-jumbled-numbers | sort-the-jumbled-numbers__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 mapping which represents the mappi... |
all-ancestors-of-a-node-in-a-directed-acyclic-graph | all-ancestors-of-a-node-in-a-directed-acyclic-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\nYou are given a positive integer n representing the number of nodes of a D... |
minimum-number-of-moves-to-make-palindrome | minimum-number-of-moves-to-make-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 only of lowercase English letters.\n\n... |
cells-in-a-range-on-an-excel-sheet | cells-in-a-range-on-an-excel-sheet__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 cell (r, c) of an excel sheet is represented as a string \"<col><row>\" ... |
append-k-integers-with-minimal-sum | append-k-integers-with-minimal-sum__01__java | Greedy | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer array nums and an integer k. Append k unique posi... |
create-binary-tree-from-descriptions | create-binary-tree-from-descriptions__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 2D integer array descriptions where descriptions[i] = [par... |
replace-non-coprime-numbers-in-array | replace-non-coprime-numbers-in-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\nYou are given an array of integers nums. Perform the following steps:\n\n\... |
number-of-single-divisor-triplets | number-of-single-divisor-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\nYou are given a 0-indexed array of positive integers nums. A triplet of th... |
find-all-k-distant-indices-in-an-array | find-all-k-distant-indices-in-an-array__01__java | Two Pointers | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed integer array nums and two integers key and k. A... |
find-all-k-distant-indices-in-an-array | find-all-k-distant-indices-in-an-array__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 a 0-indexed integer array nums and two integers key and k. A... |
find-all-k-distant-indices-in-an-array | find-all-k-distant-indices-in-an-array__03__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 integer array nums and two integers key and k. A... |
count-artifacts-that-can-be-extracted | count-artifacts-that-can-be-extracted__01__java | Hash Table | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nThere is an n x n 0-indexed grid with some artifacts buried in it. You are... |
maximize-the-topmost-element-after-k-moves | maximize-the-topmost-element-after-k-moves__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 representing the contents of ... |
minimum-weighted-subgraph-with-the-required-paths | minimum-weighted-subgraph-with-the-required-paths__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 n denoting the number of nodes of a weighted dire... |
distance-to-a-cycle-in-undirected-graph | distance-to-a-cycle-in-undirected-graph__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 positive integer n representing the number of nodes in a c... |
divide-array-into-equal-pairs | divide-array-into-equal-pairs__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 integer array nums consisting of 2 * n integers.\n\nYou n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.