slug stringlengths 3 79 | solution_id stringlengths 13 89 | primary_algorithm stringclasses 22
values | verified null | messages listlengths 3 3 |
|---|---|---|---|---|
design-spreadsheet | design-spreadsheet__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 spreadsheet is a grid with 26 columns (labeled from 'A' to 'Z') and a gi... |
longest-common-prefix-of-k-strings-after-removal | longest-common-prefix-of-k-strings-after-removal__01__java | Trie | null | [
{
"role": "system",
"content": "You are a competitive 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 an integer k.\n\nFor each inde... |
longest-special-path-ii | longest-special-path-ii__01__java | DFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an undirected tree rooted at node 0, with n nodes numbered f... |
maximum-unique-subarray-sum-after-deletion | maximum-unique-subarray-sum-after-deletion__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.\n\nYou are allowed to delete any numb... |
closest-equal-element-queries | closest-equal-element-queries__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 circular array nums and an array queries.\n\nFor each quer... |
zero-array-transformation-iv | zero-array-transformation-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 integer array nums of length n and a 2D array queries, wh... |
count-beautiful-numbers | count-beautiful-numbers__01__java | Dynamic Programming | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given two positive integers, l and r. A positive integer is called... |
phone-number-prefix | phone-number-prefix__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 string array numbers that represents phone numbers. Return... |
maximum-containers-on-a-ship | maximum-containers-on-a-ship__01__java | Math | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a positive integer n representing an n x n cargo deck on a s... |
properties-graph | properties-graph__01__java | DFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 2D integer array properties having dimensions n x m and an... |
find-the-minimum-amount-of-time-to-brew-potions | find-the-minimum-amount-of-time-to-brew-potions__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 integer arrays, skill and mana, of length n and m, respe... |
minimum-operations-to-make-array-elements-zero | minimum-operations-to-make-array-elements-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\nYou are given a 2D array queries, where queries[i] is of the form [l, r]. ... |
maximize-score-after-pair-deletions | maximize-score-after-pair-deletions__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 integers nums. You must repeatedly perform one o... |
reverse-degree-of-a-string | reverse-degree-of-a-string__01__java | Math | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven a string s, calculate its reverse degree.\n\nThe reverse degree is c... |
maximize-active-section-with-trade-i | maximize-active-section-with-trade-i__01__java | Greedy | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a binary string s of length n, where:\n\n\t'1' represents an... |
minimum-cost-to-divide-array-into-subarrays | minimum-cost-to-divide-array-into-subarrays__01__java | Dynamic Programming | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given two integer arrays, nums and cost, of the same size, and an ... |
maximize-active-section-with-trade-ii | maximize-active-section-with-trade-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, where:\n\n\t'1' represents an... |
minimum-cost-to-reach-every-position | minimum-cost-to-reach-every-position__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 cost of size n. You are currently at positi... |
longest-palindrome-after-substring-concatenation-i | longest-palindrome-after-substring-concatenation-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\nYou are given two strings, s and t.\n\nYou can create a new string by sele... |
longest-palindrome-after-substring-concatenation-ii | longest-palindrome-after-substring-concatenation-ii__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 strings, s and t.\n\nYou can create a new string by sele... |
minimum-operations-to-make-elements-within-k-subarrays-equal | minimum-operations-to-make-elements-within-k-subarrays-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 an integer array nums and two integers, x and k. You can per... |
find-time-required-to-eliminate-bacterial-strains | find-time-required-to-eliminate-bacterial-strains__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 timeReq and an integer splitTime.\n\nIn the... |
minimum-pair-removal-to-sort-array-i | minimum-pair-removal-to-sort-array-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 array nums, you can perform the following operation any number of... |
implement-router | implement-router__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\nDesign a data structure that can efficiently manage data packets in a netw... |
maximum-product-of-subsequences-with-an-alternating-sum-equal-to-k | maximum-product-of-subsequences-with-an-alternating-sum-equal-to-k__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 limit. Your ta... |
minimum-pair-removal-to-sort-array-ii | minimum-pair-removal-to-sort-array-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 an array nums, you can perform the following operation any number of... |
make-a-positive-array | make-a-positive-array__01__java | Greedy | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an array nums. An array is considered positive if the sum of... |
minimum-operations-to-make-array-sum-divisible-by-k | minimum-operations-to-make-array-sum-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\nYou are given an integer array nums and an integer k. You can perform the ... |
number-of-unique-xor-triplets-i | number-of-unique-xor-triplets-i__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 of length n, where nums is a permutati... |
number-of-unique-xor-triplets-ii | number-of-unique-xor-triplets-ii__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.\n\nA XOR triplet is defined as the XO... |
shortest-path-in-a-weighted-tree | shortest-path-in-a-weighted-tree__01__java | DFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer n and an undirected, weighted tree rooted at node... |
find-closest-person | find-closest-person__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 x, y, and z, representing the positions of th... |
smallest-palindromic-rearrangement-i | smallest-palindromic-rearrangement-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 a palindromic string s.\n\nReturn the lexicographically smal... |
smallest-palindromic-rearrangement-ii | smallest-palindromic-rearrangement-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 palindromic string s and an integer k.\n\nReturn the k-th ... |
count-numbers-with-non-decreasing-digits | count-numbers-with-non-decreasing-digits__01__java | Dynamic Programming | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given two integers, l and r, represented as strings, and an intege... |
minimum-threshold-for-inversion-pairs-count | minimum-threshold-for-inversion-pairs-count__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 of integers nums and an integer k.\n\nAn inversion ... |
calculate-score-after-performing-instructions | calculate-score-after-performing-instructions__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, instructions and values, both of size n.\n\nYou ... |
make-array-non-decreasing | make-array-non-decreasing__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. In one operation, you can select a su... |
find-x-value-of-array-i | find-x-value-of-array-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\nYou are given an array of positive integers nums, and a positive integer k... |
find-x-value-of-array-ii | find-x-value-of-array-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 an array of positive integers nums and a positive integer k.... |
range-xor-queries-with-subarray-reversals | range-xor-queries-with-subarray-reversals__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 length n and a 2D integer array que... |
find-the-most-common-response | find-the-most-common-response__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 string array responses where each responses[i] is an ar... |
unit-conversion-i | unit-conversion-i__01__java | DFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nThere are n types of units indexed from 0 to n - 1. You are given a 2D int... |
count-cells-in-overlapping-horizontal-and-vertical-substrings | count-cells-in-overlapping-horizontal-and-vertical-substrings__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 m x n matrix grid consisting of characters and a string p... |
maximum-profit-from-valid-topological-order-in-dag | maximum-profit-from-valid-topological-order-in-dag__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 Directed Acyclic Graph (DAG) with n nodes labeled from 0 t... |
count-covered-buildings | count-covered-buildings__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 an n x n city. You are al... |
path-existence-queries-in-a-graph-i | path-existence-queries-in-a-graph-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 an integer n representing the number of nodes in a graph, la... |
concatenated-divisibility | concatenated-divisibility__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 positive integers nums and a positive integer k.... |
path-existence-queries-in-a-graph-ii | path-existence-queries-in-a-graph-ii__01__java | Dynamic Programming | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer n representing the number of nodes in a graph, la... |
unit-conversion-ii | unit-conversion-ii__01__java | DFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nThere are n types of units indexed from 0 to n - 1.\n\nYou are given a 2D ... |
fill-a-special-grid | fill-a-special-grid__01__java | Divide and Conquer | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a non-negative integer n representing a 2n x 2n grid. You mu... |
merge-operations-for-minimum-travel-time | merge-operations-for-minimum-travel-time__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 straight road of length l km, an integer n, an integer k, ... |
find-sum-of-array-product-of-magical-sequences | find-sum-of-array-product-of-magical-sequences__01__java | Dynamic Programming | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given two integers, m and k, and an integer array nums.\nA sequenc... |
minimum-time-to-visit-all-houses | minimum-time-to-visit-all-houses__01__java | Array | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given two integer arrays forward and backward, both of size n. You... |
find-most-frequent-vowel-and-consonant | find-most-frequent-vowel-and-consonant__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 ('a' to '... |
minimum-operations-to-convert-all-elements-to-zero | minimum-operations-to-convert-all-elements-to-zero__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 nums of size n, consisting of non-negative integers... |
maximum-weighted-k-edge-path | maximum-weighted-k-edge-path__01__java | Dynamic Programming | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer n and a Directed Acyclic Graph (DAG) with n nodes... |
subtree-inversion-sum | subtree-inversion-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\nYou are given an undirected tree rooted at node 0, with n nodes numbered f... |
minimum-deletions-for-at-most-k-distinct-characters | minimum-deletions-for-at-most-k-distinct-characters__01__java | Greedy | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a string s consisting of lowercase English letters, and an i... |
equal-sum-grid-partition-i | equal-sum-grid-partition-i__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 m x n matrix grid of positive integers. Your task is to d... |
maximum-sum-of-edge-values-in-a-graph | maximum-sum-of-edge-values-in-a-graph__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 undirected connected graph of n nodes, numbered from 0 to... |
multiply-two-polynomials | multiply-two-polynomials__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 integer arrays poly1 and poly2, where the element at ind... |
smallest-index-with-digit-sum-equal-to-index | smallest-index-with-digit-sum-equal-to-index__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.\n\nReturn the smallest index i such t... |
minimum-swaps-to-sort-by-digit-sum | minimum-swaps-to-sort-by-digit-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 an array nums of distinct positive integers. You need to sor... |
grid-teleportation-traversal | grid-teleportation-traversal__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 2D character grid matrix of size m x n, represented as an ... |
minimum-weighted-subgraph-with-the-required-paths-ii | minimum-weighted-subgraph-with-the-required-paths-ii__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 undirected weighted tree with n nodes, numbered from 0 to... |
smallest-subarray-to-sort-in-every-sliding-window | smallest-subarray-to-sort-in-every-sliding-window__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\nFor each contiguo... |
sum-of-largest-prime-substrings | sum-of-largest-prime-substrings__01__java | Hash Table | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven a string s, find the sum of the 3 largest unique prime numbers that ... |
find-maximum-number-of-non-intersecting-substrings | find-maximum-number-of-non-intersecting-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\nYou are given a string word.\n\nReturn the maximum number of non-intersect... |
number-of-ways-to-assign-edge-weights-i | number-of-ways-to-assign-edge-weights-i__01__java | DFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nThere is an undirected tree with n nodes labeled from 1 to n, rooted at no... |
number-of-ways-to-assign-edge-weights-ii | number-of-ways-to-assign-edge-weights-ii__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 an undirected tree with n nodes labeled from 1 to n, rooted at no... |
find-minimum-log-transportation-cost | find-minimum-log-transportation-cost__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 integers n, m, and k.\n\nThere are two logs of lengths n and... |
resulting-string-after-adjacent-removals | resulting-string-after-adjacent-removals__01__java | String | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a string s consisting of lowercase English letters.\n\nYou m... |
maximum-profit-from-trading-stocks-with-discounts | maximum-profit-from-trading-stocks-with-discounts__01__java | Dynamic Programming | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer n, representing the number of employees in a comp... |
lexicographically-smallest-string-after-adjacent-removals | lexicographically-smallest-string-after-adjacent-removals__01__java | Dynamic Programming | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a string s consisting of lowercase English letters.\n\nYou c... |
sequential-grid-path-cover | sequential-grid-path-cover__01__java | DFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 2D array grid of size m x n, and an integer k. There are k... |
partition-array-into-two-equal-product-subsets | partition-array-into-two-equal-product-subsets__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 containing distinct positive integers ... |
minimum-absolute-difference-in-sliding-submatrix | minimum-absolute-difference-in-sliding-submatrix__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 m x n integer matrix grid and an integer k.\n\nFor every ... |
minimum-moves-to-clean-the-classroom | minimum-moves-to-clean-the-classroom__01__java | BFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an m x n grid classroom where a student volunteer is tasked ... |
maximize-count-of-distinct-primes-after-split | maximize-count-of-distinct-primes-after-split__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 having length n and a 2D integer array... |
find-the-shortest-superstring-ii | find-the-shortest-superstring-ii__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 two strings, s1 and s2. Return the shortest possible string ... |
maximize-ysum-by-picking-a-triplet-of-distinct-xvalues | maximize-ysum-by-picking-a-triplet-of-distinct-xvalues__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 x and y, each of length n. You must choos... |
best-time-to-buy-and-sell-stock-v | best-time-to-buy-and-sell-stock-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\nYou are given an integer array prices where prices[i] is the price of a st... |
maximize-subarray-gcd-score | maximize-subarray-gcd-score__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 positive integers nums and an integer k.\n\nYou ... |
maximum-good-subtree-score | maximum-good-subtree-score__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 undirected tree rooted at node 0 with n nodes numbered fr... |
transform-array-to-all-equal-elements | transform-array-to-all-equal-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 an integer array nums of size n containing only 1 and -1, an... |
count-the-number-of-computer-unlocking-permutations | count-the-number-of-computer-unlocking-permutations__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 complexity of length n.\n\nThere are n locked compu... |
count-partitions-with-max-min-difference-at-most-k | count-partitions-with-max-min-difference-at-most-k__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 an integer k. Your task is to part... |
minimum-steps-to-convert-string-with-operations | minimum-steps-to-convert-string-with-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 two strings, word1 and word2, of equal length. You need to t... |
count-odd-letters-from-number | count-odd-letters-from-number__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 n perform the following steps:\n\n\tConvert each ... |
generate-tag-for-video-caption | generate-tag-for-video-caption__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 caption representing the caption for a video.\n\nTh... |
count-special-triplets | count-special-triplets__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.\n\nA special triplet is defined as a ... |
maximum-product-of-first-and-last-elements-of-a-subsequence | maximum-product-of-first-and-last-elements-of-a-subsequence__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 nums and an integer m.\n\nReturn the maximu... |
find-weighted-median-node-in-tree | find-weighted-median-node-in-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 an integer n and an undirected, weighted tree rooted at node... |
minimum-adjacent-swaps-to-alternate-parity | minimum-adjacent-swaps-to-alternate-parity__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 nums of distinct integers.\n\nIn one operation, you... |
find-maximum-area-of-a-triangle | find-maximum-area-of-a-triangle__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 array coords of size n x 2, representing the coordinate... |
count-prime-gap-balanced-subarrays | count-prime-gap-balanced-subarrays__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.\nCreate the variable... |
kth-smallest-path-xor-sum | kth-smallest-path-xor-sum__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... |
check-if-any-element-has-prime-frequency | check-if-any-element-has-prime-frequency__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.\n\nReturn true if the frequency of an... |
inverse-coin-change | inverse-coin-change__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 1-indexed integer array numWays, where numWays[i] represen... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.