slug stringlengths 3 79 | solution_id stringlengths 13 89 | primary_algorithm stringclasses 22
values | verified null | messages listlengths 3 3 |
|---|---|---|---|---|
reverse-subarray-to-maximize-array-value | reverse-subarray-to-maximize-array-value__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. The value of this array is defined as... |
rank-transform-of-an-array | rank-transform-of-an-array__01__java | Sorting | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven an array of integers arr, replace each element with its rank.\n\nThe... |
remove-palindromic-subsequences | remove-palindromic-subsequences__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 string s consisting only of letters 'a' and 'b'. In a sing... |
filter-restaurants-by-vegan-friendly-price-and-distance | filter-restaurants-by-vegan-friendly-price-and-distance__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 the array restaurants where restaurants[i] = [idi, ratingi, veganFr... |
find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance | find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance__01__java | Dynamic Programming | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nThere are n cities numbered from 0 to n-1. Given the array edges where edg... |
find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance | find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance__02__java | Dynamic Programming | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nThere are n cities numbered from 0 to n-1. Given the array edges where edg... |
minimum-difficulty-of-a-job-schedule | minimum-difficulty-of-a-job-schedule__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 want to schedule a list of jobs in d days. Jobs are dependent (i.e To ... |
the-k-weakest-rows-in-a-matrix | the-k-weakest-rows-in-a-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\nYou are given an m x n binary matrix mat of 1's (representing soldiers) an... |
reduce-array-size-to-the-half | reduce-array-size-to-the-half__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 arr. You can choose a set of integers and r... |
maximum-product-of-splitted-binary-tree | maximum-product-of-splitted-binary-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\nGiven the root of a binary tree, split the binary tree into two subtrees b... |
jump-game-v | jump-game-v__01__java | Dynamic Programming | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven an array of integers arr and an integer d. In one step you can jump ... |
jump-game-v | jump-game-v__02__java | Dynamic Programming | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven an array of integers arr and an integer d. In one step you can jump ... |
number-of-steps-to-reduce-a-number-to-zero | number-of-steps-to-reduce-a-number-to-zero__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\nGiven an integer num, return the number of steps to reduce it to zero.\n\n... |
number-of-steps-to-reduce-a-number-to-zero | number-of-steps-to-reduce-a-number-to-zero__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 an integer num, return the number of steps to reduce it to zero.\n\n... |
number-of-sub-arrays-of-size-k-and-average-greater-than-or-equal-to-threshold | number-of-sub-arrays-of-size-k-and-average-greater-than-or-equal-to-threshold__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 array of integers arr and two integers k and threshold, return th... |
angle-between-hands-of-a-clock | angle-between-hands-of-a-clock__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 numbers, hour and minutes, return the smaller angle (in degrees)... |
jump-game-iv | jump-game-iv__01__java | BFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven an array of integers arr, you are initially positioned at the first ... |
check-if-n-and-its-double-exist | check-if-n-and-its-double-exist__01__java | Hash Table | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven an array arr of integers, check if there exist two indices i and j s... |
minimum-number-of-steps-to-make-two-strings-anagram | minimum-number-of-steps-to-make-two-strings-anagram__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 of the same length s and t. In one step you can ... |
tweet-counts-per-frequency | tweet-counts-per-frequency__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\nA social media company is trying to monitor activity on their site by anal... |
maximum-students-taking-exam | maximum-students-taking-exam__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\nGiven a m * n matrix seats that represent seats distributions in a classr... |
count-negative-numbers-in-a-sorted-matrix | count-negative-numbers-in-a-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 a m x n matrix grid which is sorted in non-increasing order both row... |
product-of-the-last-k-numbers | product-of-the-last-k-numbers__01__java | Math | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nDesign an algorithm that accepts a stream of integers and retrieves the pr... |
maximum-number-of-events-that-can-be-attended | maximum-number-of-events-that-can-be-attended__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 events where events[i] = [startDayi, endDayi]. E... |
construct-target-array-with-multiple-sums | construct-target-array-with-multiple-sums__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 target of n integers. From a starting array arr con... |
sort-integers-by-the-number-of-1-bits | sort-integers-by-the-number-of-1-bits__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 arr. Sort the integers in the array in asce... |
apply-discount-every-n-orders | apply-discount-every-n-orders__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 supermarket that is frequented by many customers. The products ... |
number-of-substrings-containing-all-three-characters | number-of-substrings-containing-all-three-characters__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 a string s consisting only of characters a, b and c.\n\nReturn the n... |
number-of-substrings-containing-all-three-characters | number-of-substrings-containing-all-three-characters__02__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 a string s consisting only of characters a, b and c.\n\nReturn the n... |
count-all-valid-pickup-and-delivery-options | count-all-valid-pickup-and-delivery-options__01__java | Dynamic Programming | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven n orders, each order consists of a pickup and a delivery service.\n\... |
number-of-days-between-two-dates | number-of-days-between-two-dates__01__java | Math | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nWrite a program to count the number of days between two dates.\n\nThe two ... |
validate-binary-tree-nodes | validate-binary-tree-nodes__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 have n binary tree nodes numbered from 0 to n - 1 where node i has two... |
validate-binary-tree-nodes | validate-binary-tree-nodes__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\nYou have n binary tree nodes numbered from 0 to n - 1 where node i has two... |
closest-divisors | closest-divisors__01__java | Math | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven an integer num, find the closest two integers in absolute difference... |
largest-multiple-of-three | largest-multiple-of-three__01__java | Dynamic Programming | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven an array of digits digits, return the largest multiple of three that... |
how-many-numbers-are-smaller-than-the-current-number | how-many-numbers-are-smaller-than-the-current-number__01__java | Binary Search | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven the array nums, for each nums[i] find out how many numbers in the ar... |
how-many-numbers-are-smaller-than-the-current-number | how-many-numbers-are-smaller-than-the-current-number__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\nGiven the array nums, for each nums[i] find out how many numbers in the ar... |
rank-teams-by-votes | rank-teams-by-votes__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\nIn a special ranking system, each voter gives a rank from highest to lowes... |
linked-list-in-binary-tree | linked-list-in-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\nGiven a binary tree root and a linked list with head as the first node. \n... |
minimum-cost-to-make-at-least-one-valid-path-in-a-grid | minimum-cost-to-make-at-least-one-valid-path-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\nGiven an m x n grid. Each cell of the grid has a sign pointing to the next... |
increasing-decreasing-string | increasing-decreasing-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. Reorder the string using the following algorithm... |
find-the-longest-substring-containing-vowels-in-even-counts | find-the-longest-substring-containing-vowels-in-even-counts__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 the string s, return the size of the longest substring containing ea... |
longest-zigzag-path-in-a-binary-tree | longest-zigzag-path-in-a-binary-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 the root of a binary tree.\n\nA ZigZag path for a binary tre... |
maximum-sum-bst-in-binary-tree | maximum-sum-bst-in-binary-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\nGiven a binary tree root, return the maximum sum of all keys of any sub-tr... |
generate-a-string-with-characters-that-have-odd-counts | generate-a-string-with-characters-that-have-odd-counts__01__java | String | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven an integer n, return a string with n characters such that each chara... |
number-of-times-binary-string-is-prefix-aligned | number-of-times-binary-string-is-prefix-aligned__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 have a 1-indexed binary string of length n where all the bits are 0 in... |
time-needed-to-inform-all-employees | time-needed-to-inform-all-employees__01__java | DFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nA company has n employees with a unique ID for each employee from 0 to n -... |
frog-position-after-t-seconds | frog-position-after-t-seconds__01__java | BFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven an undirected tree consisting of n vertices numbered from 1 to n. A ... |
find-a-corresponding-node-of-a-binary-tree-in-a-clone-of-that-tree | find-a-corresponding-node-of-a-binary-tree-in-a-clone-of-that-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\nGiven two binary trees original and cloned and given a reference to a node... |
lucky-numbers-in-a-matrix | lucky-numbers-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\nGiven an m x n matrix of distinct numbers, return all lucky numbers in the... |
design-a-stack-with-increment-operation | design-a-stack-with-increment-operation__01__java | Math | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nDesign a stack that supports increment operations on its elements.\n\nImpl... |
balance-a-binary-search-tree | balance-a-binary-search-tree__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 the root of a binary search tree, return a balanced binary search tr... |
maximum-performance-of-a-team | maximum-performance-of-a-team__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 integers n and k and two integer arrays speed and effici... |
find-the-distance-value-between-two-arrays | find-the-distance-value-between-two-arrays__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 two integer arrays arr1 and arr2, and the integer d, return the dist... |
cinema-seat-allocation | cinema-seat-allocation__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 cinema has n rows of seats, numbered from 1 to n. Each row has 10 seats,... |
sort-integers-by-the-power-value | sort-integers-by-the-power-value__01__java | Sorting | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nThe power of an integer x is defined as the number of steps needed to tran... |
pizza-with-3n-slices | pizza-with-3n-slices__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 pizza with 3n slices of varying size, you and your friends will... |
create-target-array-in-the-given-order | create-target-array-in-the-given-order__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 arrays of integers nums and index. Your task is to create target... |
four-divisors | four-divisors__01__java | Math | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven an integer array nums, return the sum of divisors of the integers in... |
check-if-there-is-a-valid-path-in-a-grid | check-if-there-is-a-valid-path-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 grid. Each cell of grid represents a street. The st... |
longest-happy-prefix | longest-happy-prefix__01__java | String | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nA string is called a happy prefix if is a non-empty prefix which is also a... |
longest-happy-prefix | longest-happy-prefix__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\nA string is called a happy prefix if is a non-empty prefix which is also a... |
find-lucky-integer-in-an-array | find-lucky-integer-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\nGiven an array of integers arr, a lucky integer is an integer that has a f... |
count-number-of-teams | count-number-of-teams__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\nThere are n soldiers standing in a line. Each soldier is assigned a unique... |
count-number-of-teams | count-number-of-teams__02__java | Dynamic Programming | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nThere are n soldiers standing in a line. Each soldier is assigned a unique... |
design-underground-system | design-underground-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\nAn underground railway system is keeping track of customer travel times be... |
find-all-good-strings | find-all-good-strings__01__java | Dynamic Programming | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven the strings s1 and s2 of size n and the string evil, return the numb... |
count-largest-group | count-largest-group__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 n.\n\nWe need to group the numbers from 1 to n ac... |
construct-k-palindrome-strings | construct-k-palindrome-strings__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 s and an integer k, return true if you can use all the char... |
circle-and-rectangle-overlapping | circle-and-rectangle-overlapping__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 circle represented as (radius, xCenter, yCenter) and an ax... |
reducing-dishes | reducing-dishes__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 chef has collected data on the satisfaction level of his n dishes. Chef ... |
minimum-subsequence-in-non-increasing-order | minimum-subsequence-in-non-increasing-order__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 the array nums, obtain a subsequence of the array whose sum of eleme... |
number-of-steps-to-reduce-a-number-in-binary-representation-to-one | number-of-steps-to-reduce-a-number-in-binary-representation-to-one__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 the binary representation of an integer as a string s, return the nu... |
longest-happy-string | longest-happy-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 s is called happy if it satisfies the following conditions:\n\n\t... |
stone-game-iii | stone-game-iii__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\nAlice and Bob continue their games with piles of stones. There are several... |
string-matching-in-an-array | string-matching-in-an-array__01__java | Brute Force | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven an array of string words, return all strings in words that are a sub... |
queries-on-a-permutation-with-key | queries-on-a-permutation-with-key__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 the array queries of positive integers between 1 and m, you have to ... |
queries-on-a-permutation-with-key | queries-on-a-permutation-with-key__02__java | Array | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven the array queries of positive integers between 1 and m, you have to ... |
html-entity-parser | html-entity-parser__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\nHTML entity parser is the parser that takes HTML code as input and replace... |
number-of-ways-to-paint-n-3-grid | number-of-ways-to-paint-n-3-grid__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 have a grid of size n x 3 and you want to paint each cell of the grid ... |
number-of-ways-to-paint-n-3-grid | number-of-ways-to-paint-n-3-grid__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 have a grid of size n x 3 and you want to paint each cell of the grid ... |
minimum-value-to-get-positive-step-by-step-sum | minimum-value-to-get-positive-step-by-step-sum__01__java | Array | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven an array of integers nums, you start with an initial positive value ... |
find-the-minimum-number-of-fibonacci-numbers-whose-sum-is-k | find-the-minimum-number-of-fibonacci-numbers-whose-sum-is-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\nGiven an integer k, return the minimum number of Fibonacci numbers whose s... |
the-k-th-lexicographical-string-of-all-happy-strings-of-length-n | the-k-th-lexicographical-string-of-all-happy-strings-of-length-n__01__java | DFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nA happy string is a string that:\n\n\tconsists only of letters of the set ... |
the-k-th-lexicographical-string-of-all-happy-strings-of-length-n | the-k-th-lexicographical-string-of-all-happy-strings-of-length-n__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\nA happy string is a string that:\n\n\tconsists only of letters of the set ... |
restore-the-array | restore-the-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\nA program was supposed to print an array of integers. The program forgot t... |
reformat-the-string | reformat-the-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 an alphanumeric string s. (Alphanumeric string is a string c... |
display-table-of-food-orders-in-a-restaurant | display-table-of-food-orders-in-a-restaurant__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 the array orders, which represents the orders that customers have do... |
minimum-number-of-frogs-croaking | minimum-number-of-frogs-croaking__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 string croakOfFrogs, which represents a combination of t... |
build-array-where-you-can-find-the-maximum-exactly-k-comparisons | build-array-where-you-can-find-the-maximum-exactly-k-comparisons__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 three integers n, m and k. Consider the following algorithm ... |
maximum-score-after-splitting-a-string | maximum-score-after-splitting-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 string s of zeros and ones, return the maximum score after splitti... |
maximum-points-you-can-obtain-from-cards | maximum-points-you-can-obtain-from-cards__01__java | Sliding Window | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nThere are several cards arranged in a row, and each card has an associated... |
diagonal-traverse-ii | diagonal-traverse-ii__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 a 2D integer array nums, return all elements of nums in diagonal ord... |
constrained-subsequence-sum | constrained-subsequence-sum__01__java | Dynamic Programming | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven an integer array nums and an integer k, return the maximum sum of a ... |
counting-elements | counting-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\nGiven an integer array arr, count how many elements x there are, such that... |
perform-string-shifts | perform-string-shifts__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 containing lowercase English letters, and a matri... |
leftmost-column-with-at-least-a-one | leftmost-column-with-at-least-a-one__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\nA row-sorted binary matrix means that all elements are 0 or 1 and each row... |
first-unique-number | first-unique-number__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 have a queue of integers, you need to retrieve the first unique intege... |
first-unique-number | first-unique-number__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 have a queue of integers, you need to retrieve the first unique intege... |
check-if-a-string-is-a-valid-sequence-from-root-to-leaves-path-in-a-binary-tree | check-if-a-string-is-a-valid-sequence-from-root-to-leaves-path-in-a-binary-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\nGiven a binary tree where each path going from the root to any leaf form a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.