slug stringlengths 3 79 | solution_id stringlengths 13 89 | primary_algorithm stringclasses 22
values | verified null | messages listlengths 3 3 |
|---|---|---|---|---|
minimum-operations-to-make-array-values-equal-to-k | minimum-operations-to-make-array-values-equal-to-k__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 and an integer k.\n\nAn integer h is c... |
minimum-time-to-break-locks-i | minimum-time-to-break-locks-i__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\nBob is stuck in a dungeon and must break n locks, each requiring some amou... |
digit-operations-to-make-two-integers-equal | digit-operations-to-make-two-integers-equal__01__java | Graph | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given two integers n and m that consist of the same number of digi... |
count-connected-components-in-lcm-graph | count-connected-components-in-lcm-graph__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 of integers nums of size n and a positive integer t... |
count-connected-components-in-lcm-graph | count-connected-components-in-lcm-graph__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 an array of integers nums of size n and a positive integer t... |
transformed-array | transformed-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 integer array nums that represents a circular array. Your... |
maximum-area-rectangle-with-point-constraints-i | maximum-area-rectangle-with-point-constraints-i__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 points where points[i] = [xi, yi] represents the co... |
maximum-subarray-sum-with-length-divisible-by-k | maximum-subarray-sum-with-length-divisible-by-k__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 and an integer k.\n\nReturn the ma... |
maximum-area-rectangle-with-point-constraints-ii | maximum-area-rectangle-with-point-constraints-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\nThere are n points on an infinite plane. You are given two integer arrays ... |
minimum-runes-to-add-to-cast-spell | minimum-runes-to-add-to-cast-spell__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\nAlice has just graduated from wizard school, and wishes to cast a magic sp... |
minimum-time-to-break-locks-ii | minimum-time-to-break-locks-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\nBob is stuck in a dungeon and must break n locks, each requiring some amou... |
button-with-longest-push-time | button-with-longest-push-time__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 2D array events which represents a sequence of events wher... |
maximize-amount-after-two-days-of-conversions | maximize-amount-after-two-days-of-conversions__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 string initialCurrency, and you start with 1.0 of initialC... |
count-beautiful-splits-in-an-array | count-beautiful-splits-in-an-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 array nums.\n\nA split of an array nums is beautiful if:\... |
minimum-operations-to-make-character-frequencies-equal | minimum-operations-to-make-character-frequencies-equal__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.\n\nA string t is called good if all characters o... |
design-a-3d-binary-matrix-with-efficient-layer-tracking | design-a-3d-binary-matrix-with-efficient-layer-tracking__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 n x n x n binary 3D array matrix.\n\nImplement the Matrix3... |
count-subarrays-of-length-three-with-a-condition | count-subarrays-of-length-three-with-a-condition__01__java | Array | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven an integer array nums, return the number of subarrays of length 3 su... |
count-paths-with-the-given-xor-value | count-paths-with-the-given-xor-value__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 2D integer array grid with size m x n. You are also given ... |
check-if-grid-can-be-cut-into-sections | check-if-grid-can-be-cut-into-sections__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 representing the dimensions of an n x n grid, w... |
subsequences-with-a-unique-middle-mode-i | subsequences-with-a-unique-middle-mode-i__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, find the number of subsequences of size 5 of ... |
minimum-number-of-operations-to-make-elements-in-array-distinct | minimum-number-of-operations-to-make-elements-in-array-distinct__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 ensure that the elements ... |
maximum-number-of-distinct-elements-after-operations | maximum-number-of-distinct-elements-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 an integer array nums and an integer k.\n\nYou are allowed t... |
smallest-substring-with-identical-characters-i | smallest-substring-with-identical-characters-i__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 binary string s of length n and an integer numOps.\n\nYou ... |
smallest-substring-with-identical-characters-ii | smallest-substring-with-identical-characters-ii__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 binary string s of length n and an integer numOps.\n\nYou ... |
maximum-number-of-matching-indices-after-right-shifts | maximum-number-of-matching-indices-after-right-shifts__01__java | Two Pointers | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given two integer arrays, nums1 and nums2, of the same length.\n\n... |
minimum-operations-to-make-columns-strictly-increasing | minimum-operations-to-make-columns-strictly-increasing__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 m x n matrix grid consisting of non-negative integers.\n\n... |
find-the-lexicographically-largest-string-from-the-box-i | find-the-lexicographically-largest-string-from-the-box-i__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 string word, and an integer numFriends.\n\nAlice is organi... |
count-special-subsequences | count-special-subsequences__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 nums consisting of positive integers.\n\nA special ... |
count-the-number-of-arrays-with-k-matching-adjacent-elements | count-the-number-of-arrays-with-k-matching-adjacent-elements__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 three integers n, m, k. A good array arr of size n is define... |
find-the-lexicographically-largest-string-from-the-box-ii | find-the-lexicographically-largest-string-from-the-box-ii__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 word, and an integer numFriends.\n\nAlice is organi... |
substring-matching-pattern | substring-matching-pattern__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 and a pattern string p, where p contains exactly ... |
design-task-manager | design-task-manager__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 a task management system that allows users to manage their tasks,... |
longest-subsequence-with-decreasing-adjacent-difference | longest-subsequence-with-decreasing-adjacent-difference__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 of integers nums.\n\nYour task is to find the lengt... |
maximize-subarray-sum-after-removing-all-occurrences-of-one-element | maximize-subarray-sum-after-removing-all-occurrences-of-one-element__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.\n\nYou can do the following operation... |
maximum-subarray-with-equal-products | maximum-subarray-with-equal-products__01__java | Sliding Window | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an array of positive integers nums.\n\nAn array arr is calle... |
find-mirror-score-of-a-string | find-mirror-score-of-a-string__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 string s.\n\nWe define the mirror of a letter in the Engli... |
maximum-coins-from-k-consecutive-bags | maximum-coins-from-k-consecutive-bags__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 an infinite amount of bags on a number line, one bag for each co... |
maximum-score-of-non-overlapping-intervals | maximum-score-of-non-overlapping-intervals__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 2D integer array intervals, where intervals[i] = [li, ri, ... |
subsequences-with-a-unique-middle-mode-ii | subsequences-with-a-unique-middle-mode-ii__01__java | Math | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven an integer array nums, find the number of subsequences of size 5 of ... |
zigzag-grid-traversal-with-skip | zigzag-grid-traversal-with-skip__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 m x n 2D array grid of positive integers.\n\nYour task is... |
maximum-amount-of-money-robot-can-earn | maximum-amount-of-money-robot-can-earn__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 m x n grid. A robot starts at the top-left corner of the ... |
minimize-the-maximum-edge-weight-of-graph | minimize-the-maximum-edge-weight-of-graph__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 integers, n and threshold, as well as a directed weighte... |
count-non-decreasing-subarrays-after-k-operations | count-non-decreasing-subarrays-after-k-operations__01__java | Sliding Window | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an array nums of n integers and an integer k.\n\nFor each su... |
minimum-operations-to-make-subarray-elements-equal | minimum-operations-to-make-subarray-elements-equal__01__java | Sliding Window | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer array nums and an integer k. You can perform the ... |
maximum-difference-between-adjacent-elements-in-a-circular-array | maximum-difference-between-adjacent-elements-in-a-circular-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 a circular array nums, find the maximum absolute difference between ... |
minimum-cost-to-make-arrays-identical | minimum-cost-to-make-arrays-identical__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 integer arrays arr and brr of length n, and an integer k... |
longest-special-path | longest-special-path__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 undirected tree rooted at node 0 with n nodes numbered fr... |
manhattan-distances-of-all-arrangements-of-pieces | manhattan-distances-of-all-arrangements-of-pieces__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 three integers m, n, and k.\n\nThere is a rectangular grid o... |
sum-of-variable-length-subarrays | sum-of-variable-length-subarrays__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 array nums of size n. For each index i where 0 <=... |
maximum-and-minimum-sums-of-at-most-size-k-subsequences | maximum-and-minimum-sums-of-at-most-size-k-subsequences__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 and a positive integer k. Return the s... |
paint-house-iv | paint-house-iv__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 even integer n representing the number of houses arranged... |
minimum-unlocked-indices-to-sort-nums | minimum-unlocked-indices-to-sort-nums__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 nums consisting of integers between 1 and 3, and a ... |
count-partitions-with-even-sum-difference | count-partitions-with-even-sum-difference__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 array nums of length n.\n\nA partition is defined... |
count-mentions-per-user | count-mentions-per-user__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 numberOfUsers representing the total number of us... |
maximum-frequency-after-subarray-operation | maximum-frequency-after-subarray-operation__01__java | Dynamic Programming | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an array nums of length n. You are also given an integer k.\... |
frequencies-of-shortest-supersequences | frequencies-of-shortest-supersequences__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 of strings words. Find all shortest common superseq... |
permutations-iii | permutations-iii__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 an integer n, an alternating permutation is a permutation of the fir... |
find-valid-pair-of-adjacent-digits-in-string | find-valid-pair-of-adjacent-digits-in-string__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 string s consisting only of digits. A valid pair is define... |
reschedule-meetings-for-maximum-free-time-i | reschedule-meetings-for-maximum-free-time-i__01__java | Sliding Window | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer eventTime denoting the duration of an event, wher... |
reschedule-meetings-for-maximum-free-time-i | reschedule-meetings-for-maximum-free-time-i__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\nYou are given an integer eventTime denoting the duration of an event, wher... |
reschedule-meetings-for-maximum-free-time-ii | reschedule-meetings-for-maximum-free-time-ii__01__java | Greedy | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer eventTime denoting the duration of an event. You ... |
minimum-cost-good-caption | minimum-cost-good-caption__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 caption of length n. A good caption is a string whe... |
maximum-difference-between-even-and-odd-frequency-i | maximum-difference-between-even-and-odd-frequency-i__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 string s consisting of lowercase English letters.\n\nYour ... |
maximum-manhattan-distance-after-k-changes | maximum-manhattan-distance-after-k-changes__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 the characters 'N', 'S', 'E', and '... |
minimum-increments-for-target-multiples-in-an-array | minimum-increments-for-target-multiples-in-an-array__01__java | Dynamic Programming | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given two arrays, nums and target.\n\nIn a single operation, you m... |
maximum-difference-between-even-and-odd-frequency-ii | maximum-difference-between-even-and-odd-frequency-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\nYou are given a string s and an integer k. Your task is to find the maximu... |
sort-matrix-by-diagonals | sort-matrix-by-diagonals__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 n x n square matrix of integers grid. Return the matrix s... |
assign-elements-to-groups-with-constraints | assign-elements-to-groups-with-constraints__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 groups, where groups[i] represents the size... |
count-substrings-divisible-by-last-digit | count-substrings-divisible-by-last-digit__01__java | Dynamic Programming | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a string s consisting of digits.\n\nReturn the number of sub... |
maximize-the-minimum-game-score | maximize-the-minimum-game-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 an array points of size n and an integer m. There is another... |
maximum-students-on-a-single-bench | maximum-students-on-a-single-bench__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 of student data students, where students[... |
sum-of-good-numbers | sum-of-good-numbers__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 and an integer k, an element nums[i] is co... |
separate-squares-i | separate-squares-i__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 2D integer array squares. Each squares[i] = [xi, yi, li] r... |
separate-squares-ii | separate-squares-ii__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 2D integer array squares. Each squares[i] = [xi, yi, li] r... |
shortest-matching-substring | shortest-matching-substring__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 and a pattern string p, where p contains exactly ... |
find-special-substring-of-length-k | find-special-substring-of-length-k__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 and an integer k.\n\nDetermine if there exists a ... |
eat-pizzas | eat-pizzas__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 pizzas of size n, where pizzas[i] represent... |
select-k-disjoint-special-substrings | select-k-disjoint-special-substrings__01__java | Dynamic Programming | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven a string s of length n and an integer k, determine whether it is pos... |
length-of-longest-v-shaped-diagonal-segment | length-of-longest-v-shaped-diagonal-segment__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 2D integer matrix grid of size n x m, where each element i... |
longest-common-prefix-after-at-most-one-removal | longest-common-prefix-after-at-most-one-removal__01__java | Two Pointers | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given two strings s and t.\n\nReturn the length of the longest com... |
check-if-digits-are-equal-in-string-after-operations-i | check-if-digits-are-equal-in-string-after-operations-i__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 consisting of digits. Perform the following opera... |
maximum-sum-with-at-most-k-elements | maximum-sum-with-at-most-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 2D integer matrix grid of size n x m, an integer array lim... |
check-if-digits-are-equal-in-string-after-operations-ii | check-if-digits-are-equal-in-string-after-operations-ii__01__java | Math | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a string s consisting of digits. Perform the following opera... |
maximize-the-distance-between-points-on-a-square | maximize-the-distance-between-points-on-a-square__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 side, representing the edge length of a square wi... |
maximum-coin-collection | maximum-coin-collection__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\nMario drives on a two-lane freeway with coins every mile. You are given tw... |
transform-array-by-parity | transform-array-by-parity__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. Transform nums by performing the foll... |
find-the-number-of-copy-arrays | find-the-number-of-copy-arrays__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 original of length n and a 2D array bounds of lengt... |
find-minimum-cost-to-remove-array-elements | find-minimum-cost-to-remove-array-elements__01__java | Brute Force | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer array nums. Your task is to remove all elements f... |
permutations-iv | permutations-iv__01__java | Math | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven two integers, n and k, an alternating permutation is a permutation o... |
find-the-largest-almost-missing-integer | find-the-largest-almost-missing-integer__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 and an integer k.\n\nAn integer x is a... |
longest-palindromic-subsequence-after-at-most-k-operations | longest-palindromic-subsequence-after-at-most-k-operations__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 and an integer k.\n\nIn one operation, you can re... |
sum-of-k-subarrays-with-length-at-least-m | sum-of-k-subarrays-with-length-at-least-m__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 and two integers, k and m.\n\nReturn t... |
lexicographically-smallest-generated-string | lexicographically-smallest-generated-string__01__java | Greedy | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given two strings, str1 and str2, of lengths n and m, respectively... |
maximize-profit-from-task-assignment | maximize-profit-from-task-assignment__01__java | Heap | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer array workers, where workers[i] represents the sk... |
fruits-into-baskets-ii | fruits-into-baskets-ii__01__java | Math | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given two arrays of integers, fruits and baskets, each of length n... |
choose-k-elements-with-maximum-sum | choose-k-elements-with-maximum-sum__01__java | Sorting | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given two integer arrays, nums1 and nums2, both of length n, along... |
fruits-into-baskets-iii | fruits-into-baskets-iii__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 arrays of integers, fruits and baskets, each of length n... |
maximize-subarrays-after-removing-one-conflicting-pair | maximize-subarrays-after-removing-one-conflicting-pair__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 which represents an array nums containing the n... |
apply-substitutions | apply-substitutions__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 replacements mapping and a text string that may contain pl... |
unique-3-digit-even-numbers | unique-3-digit-even-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\nYou are given an array of digits called digits. Your task is to determine ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.