slug stringlengths 3 79 | solution_id stringlengths 13 89 | primary_algorithm stringclasses 22
values | verified null | messages listlengths 3 3 |
|---|---|---|---|---|
linked-list-frequency | linked-list-frequency__01__java | Hash Table | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven the head of a linked list containing k distinct elements, return the... |
guess-the-number-using-bitwise-questions-i | guess-the-number-using-bitwise-questions-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\nThere is a number n that you have to find.\n\nThere is also a pre-defined ... |
minimum-operations-to-exceed-threshold-value-i | minimum-operations-to-exceed-threshold-value-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 a 0-indexed integer array nums, and an integer k.\n\nIn one ... |
minimum-operations-to-exceed-threshold-value-ii | minimum-operations-to-exceed-threshold-value-ii__01__java | Heap | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed integer array nums, and an integer k.\n\nYou are... |
count-pairs-of-connectable-servers-in-a-weighted-tree-network | count-pairs-of-connectable-servers-in-a-weighted-tree-network__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 unrooted weighted tree with n vertices representing serve... |
find-the-maximum-sum-of-node-values | find-the-maximum-sum-of-node-values__01__java | Dynamic Programming | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nThere exists an undirected tree with n nodes numbered 0 to n - 1. You are ... |
distribute-elements-into-two-arrays-i | distribute-elements-into-two-arrays-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 1-indexed array of distinct integers nums of length n.\n\n... |
count-submatrices-with-top-left-element-and-sum-less-than-k | count-submatrices-with-top-left-element-and-sum-less-than-k__01__java | Array | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed integer matrix grid and an integer k.\n\nReturn ... |
minimum-operations-to-write-the-letter-y-on-a-grid | minimum-operations-to-write-the-letter-y-on-a-grid__01__java | Hash Table | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed n x n grid where n is odd, and grid[r][c] is 0, ... |
distribute-elements-into-two-arrays-ii | distribute-elements-into-two-arrays-ii__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 1-indexed array of integers nums of length n.\n\nWe define... |
maximum-increasing-triplet-value | maximum-increasing-triplet-value__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 nums, return the maximum value of a triplet (i, j, k) such ... |
apple-redistribution-into-boxes | apple-redistribution-into-boxes__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 apple of size n and an array capacity of size m.\n\... |
maximize-happiness-of-selected-children | maximize-happiness-of-selected-children__01__java | Greedy | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an array happiness of length n, and a positive integer k.\n\... |
shortest-uncommon-substring-in-an-array | shortest-uncommon-substring-in-an-array__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 arr of size n consisting of non-empty strings.\n\nF... |
maximum-strength-of-k-disjoint-subarrays | maximum-strength-of-k-disjoint-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 an array of integers nums with length n, and a positive odd ... |
match-alphanumerical-pattern-in-matrix-i | match-alphanumerical-pattern-in-matrix-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 2D integer matrix board and a 2D character matrix pattern.... |
find-the-sum-of-encrypted-integers | find-the-sum-of-encrypted-integers__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 containing positive integers. We defin... |
mark-elements-on-array-by-performing-queries | mark-elements-on-array-by-performing-queries__01__java | Sorting | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed array nums of size n consisting of positive inte... |
replace-question-marks-in-string-to-minimize-its-value | replace-question-marks-in-string-to-minimize-its-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 a string s. s[i] is either a lowercase English letter or '?'... |
find-the-sum-of-the-power-of-all-subsequences | find-the-sum-of-the-power-of-all-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 of length n and a positive integer k.\... |
find-the-sum-of-the-power-of-all-subsequences | find-the-sum-of-the-power-of-all-subsequences__02__java | Dynamic Programming | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer array nums of length n and a positive integer k.\... |
existence-of-a-substring-in-a-string-and-its-reverse | existence-of-a-substring-in-a-string-and-its-reverse__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 any substring of length 2 which is also present in ... |
count-substrings-starting-and-ending-with-given-character | count-substrings-starting-and-ending-with-given-character__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 and a character c. Return the total number of sub... |
minimum-deletions-to-make-string-k-special | minimum-deletions-to-make-string-k-special__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 word and an integer k.\n\nWe consider word to be k-... |
minimum-moves-to-pick-k-ones | minimum-moves-to-pick-k-ones__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 array nums of length n, a positive integer k and a ... |
make-string-anti-palindrome | make-string-anti-palindrome__01__java | Greedy | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nWe call a string s of even length n an anti-palindrome if for each index 0... |
maximum-length-substring-with-two-occurrences | maximum-length-substring-with-two-occurrences__01__java | Two Pointers | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven a string s, return the maximum length of a substring such that it co... |
apply-operations-to-make-sum-of-array-greater-than-or-equal-to-k | apply-operations-to-make-sum-of-array-greater-than-or-equal-to-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\nYou are given a positive integer k. Initially, you have an array nums = [1... |
most-frequent-ids | most-frequent-ids__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\nThe problem involves tracking the frequency of IDs in a collection that ch... |
longest-common-suffix-queries | longest-common-suffix-queries__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 two arrays of strings wordsContainer and wordsQuery.\n\nFor ... |
guess-the-number-using-bitwise-questions-ii | guess-the-number-using-bitwise-questions-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\nThere is a number n between 0 and 230 - 1 (both inclusive) that you have t... |
shortest-subarray-with-or-at-least-k-i | shortest-subarray-with-or-at-least-k-i__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 array nums of non-negative integers and an integer k.\n\n... |
minimum-levels-to-gain-more-points | minimum-levels-to-gain-more-points__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 binary array possible of length n.\n\nAlice and Bob are pl... |
shortest-subarray-with-or-at-least-k-ii | shortest-subarray-with-or-at-least-k-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 an array nums of non-negative integers and an integer k.\n\n... |
find-the-sum-of-subsequence-powers | find-the-sum-of-subsequence-powers__01__java | Memoization | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer array nums of length n, and a positive integer k.... |
harshad-number | harshad-number__01__java | Math | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nAn integer divisible by the sum of its digits is said to be a Harshad numb... |
water-bottles-ii | water-bottles-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 integers numBottles and numExchange.\n\nnumBottles repre... |
count-alternating-subarrays | count-alternating-subarrays__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 binary array nums.\n\nWe call a subarray alternating if no... |
minimize-manhattan-distances | minimize-manhattan-distances__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 representing integer coordinates of some poi... |
find-longest-self-contained-substring | find-longest-self-contained-substring__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 string s, your task is to find the length of the longest self-cont... |
longest-strictly-increasing-or-strictly-decreasing-subarray | longest-strictly-increasing-or-strictly-decreasing-subarray__01__java | Array | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an array of integers nums. Return the length of the longest ... |
lexicographically-smallest-string-after-operations-with-constraint | lexicographically-smallest-string-after-operations-with-constraint__01__java | Greedy | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a string s and an integer k.\n\nDefine a function distance(s... |
minimum-operations-to-make-median-of-array-equal-to-k | minimum-operations-to-make-median-of-array-equal-to-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\nYou are given an integer array nums and a non-negative integer k. In one o... |
minimum-cost-walk-in-weighted-graph | minimum-cost-walk-in-weighted-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\nThere is an undirected weighted graph with n vertices labeled from 0 to n ... |
find-the-index-of-permutation | find-the-index-of-permutation__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 an array perm of length n which is a permutation of [1, 2, ..., n], ... |
score-of-a-string | score-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\nYou are given a string s. The score of a string is defined as the sum of t... |
minimum-rectangles-to-cover-points | minimum-rectangles-to-cover-points__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 array points, where points[i] = [xi, yi]. You a... |
minimum-time-to-visit-disappearing-nodes | minimum-time-to-visit-disappearing-nodes__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\nThere is an undirected graph of n nodes. You are given a 2D array edges, w... |
find-the-number-of-subarrays-where-boundary-elements-are-maximum | find-the-number-of-subarrays-where-boundary-elements-are-maximum__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 positive integers nums.\n\nReturn the number of ... |
latest-time-you-can-obtain-after-replacing-characters | latest-time-you-can-obtain-after-replacing-characters__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 representing a 12-hour format time where some of ... |
latest-time-you-can-obtain-after-replacing-characters | latest-time-you-can-obtain-after-replacing-characters__02__java | String | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a string s representing a 12-hour format time where some of ... |
maximum-prime-difference | maximum-prime-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.\n\nReturn an integer that is the maxi... |
kth-smallest-amount-with-single-denomination-combination | kth-smallest-amount-with-single-denomination-combination__01__java | Binary Search | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer array coins representing coins of different denom... |
minimum-sum-of-values-by-dividing-array | minimum-sum-of-values-by-dividing-array__01__java | Memoization | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given two arrays nums and andValues of length n and m respectively... |
maximum-number-of-potholes-that-can-be-fixed | maximum-number-of-potholes-that-can-be-fixed__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 road, consisting only of characters \"x\" and \".\"... |
count-the-number-of-special-characters-i | count-the-number-of-special-characters-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 word. A letter is called special if it appears both... |
count-the-number-of-special-characters-ii | count-the-number-of-special-characters-ii__01__java | Hash Table | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a string word. A letter c is called special if it appears bo... |
minimum-number-of-operations-to-satisfy-conditions | minimum-number-of-operations-to-satisfy-conditions__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 matrix grid of size m x n. In one operation, you can ch... |
find-edges-in-shortest-paths | find-edges-in-shortest-paths__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 undirected weighted graph of n nodes numbered from 0 to n... |
maximum-number-that-makes-result-of-bitwise-and-zero | maximum-number-that-makes-result-of-bitwise-and-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 n, return the maximum integer x such that x <= n, and the... |
make-a-square-with-the-same-color | make-a-square-with-the-same-color__01__java | Array | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 2D matrix grid of size 3 x 3 consisting only of characters... |
right-triangles | right-triangles__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 2D boolean matrix grid.\n\nA collection of 3 elements of g... |
find-all-possible-stable-binary-arrays-i | find-all-possible-stable-binary-arrays-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 3 positive integers num_zeros, num_ones, and limit.\n\nA bin... |
find-all-possible-stable-binary-arrays-i | find-all-possible-stable-binary-arrays-i__02__java | Dynamic Programming | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given 3 positive integers num_zeros, num_ones, and limit.\n\nA bin... |
find-all-possible-stable-binary-arrays-ii | find-all-possible-stable-binary-arrays-ii__01__java | Memoization | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given 3 positive integers num_zeros, num_ones, and limit.\n\nA bin... |
find-all-possible-stable-binary-arrays-ii | find-all-possible-stable-binary-arrays-ii__02__java | Dynamic Programming | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given 3 positive integers num_zeros, num_ones, and limit.\n\nA bin... |
find-the-integer-added-to-array-i | find-the-integer-added-to-array-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 two arrays of equal length, nums1 and nums2.\n\nEach element... |
find-the-integer-added-to-array-ii | find-the-integer-added-to-array-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 two integer arrays nums1 and nums2.\n\nFrom nums1 two elemen... |
minimum-array-end | minimum-array-end__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 x. You have to construct an array of posi... |
find-the-median-of-the-uniqueness-array | find-the-median-of-the-uniqueness-array__01__java | Two Pointers | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer array nums. The uniqueness array of nums is the s... |
equalize-strings-by-adding-or-removing-characters-at-ends | equalize-strings-by-adding-or-removing-characters-at-ends__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 two strings initial and target, your task is to modify initial by pe... |
valid-word | valid-word__01__java | Math | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nA word is considered valid if:\n\n\tIt contains a minimum of 3 characters.... |
minimum-number-of-operations-to-make-word-k-periodic | minimum-number-of-operations-to-make-word-k-periodic__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 word of size n, and an integer k such that k divide... |
minimum-length-of-anagram-concatenation | minimum-length-of-anagram-concatenation__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, which is known to be a concatenation of anagrams... |
minimum-cost-to-equalize-array | minimum-cost-to-equalize-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 integer array nums and two integers cost1 and cost2. You ... |
maximum-hamming-distances | maximum-hamming-distances__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 nums and an integer m, with each element nums[i] satisfying... |
check-if-grid-satisfies-conditions | check-if-grid-satisfies-conditions__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 2D matrix grid of size m x n. You need to check if each ce... |
maximum-points-inside-the-square | maximum-points-inside-the-square__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 2D array points and a string s where, points[i] represents... |
minimum-substring-partition-of-equal-character-frequency | minimum-substring-partition-of-equal-character-frequency__01__java | Hash Table | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven a string s, you need to partition it into one or more balanced subst... |
minimum-substring-partition-of-equal-character-frequency | minimum-substring-partition-of-equal-character-frequency__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 a string s, you need to partition it into one or more balanced subst... |
minimum-substring-partition-of-equal-character-frequency | minimum-substring-partition-of-equal-character-frequency__03__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, you need to partition it into one or more balanced subst... |
find-products-of-elements-of-big-array | find-products-of-elements-of-big-array__01__java | Binary Search | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nThe powerful array of a non-negative integer x is defined as the shortest ... |
permutation-difference-between-two-strings | permutation-difference-between-two-strings__01__java | Hash Table | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given two strings s and t such that every character occurs at most... |
taking-maximum-energy-from-the-mystic-dungeon | taking-maximum-energy-from-the-mystic-dungeon__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\nIn a mystic dungeon, n magicians are standing in a line. Each magician has... |
maximum-difference-score-in-a-grid | maximum-difference-score-in-a-grid__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 matrix grid consisting of positive integers. You ca... |
find-the-minimum-cost-array-permutation | find-the-minimum-cost-array-permutation__01__java | Memoization | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an array nums which is a permutation of [0, 1, 2, ..., n - 1... |
special-array-i | special-array-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\nAn array is considered special if the parity of every pair of adjacent ele... |
special-array-ii | special-array-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\nAn array is considered special if every pair of its adjacent elements cont... |
sum-of-digit-differences-of-all-pairs | sum-of-digit-differences-of-all-pairs__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 where all inte... |
find-number-of-ways-to-reach-the-k-th-stair | find-number-of-ways-to-reach-the-k-th-stair__01__java | Memoization | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a non-negative integer k. There exists a staircase with an i... |
maximum-number-of-upgradable-servers | maximum-number-of-upgradable-servers__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 have n data centers and need to upgrade their servers.\n\nYou are give... |
find-the-level-of-tree-with-minimum-sum | find-the-level-of-tree-with-minimum-sum__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 the root of a binary tree root where each node has a value, return t... |
find-the-xor-of-numbers-which-appear-twice | find-the-xor-of-numbers-which-appear-twice__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 array nums, where each number in the array appears either... |
find-the-xor-of-numbers-which-appear-twice | find-the-xor-of-numbers-which-appear-twice__02__java | Bit Manipulation | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an array nums, where each number in the array appears either... |
find-occurrences-of-an-element-in-an-array | find-occurrences-of-an-element-in-an-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, an integer array queries, and an inte... |
find-the-number-of-distinct-colors-among-the-balls | find-the-number-of-distinct-colors-among-the-balls__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 limit and a 2D array queries of size n x 2.\n\nTh... |
block-placement-queries | block-placement-queries__01__java | Binary Search | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nThere exists an infinite number line, with its origin at 0 and extending t... |
find-the-number-of-good-pairs-i | find-the-number-of-good-pairs-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 2 integer arrays nums1 and nums2 of lengths n and m respecti... |
find-the-number-of-good-pairs-i | find-the-number-of-good-pairs-i__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 are given 2 integer arrays nums1 and nums2 of lengths n and m respecti... |
string-compression-iii | string-compression-iii__01__java | Two Pointers | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven a string word, compress it using the following algorithm:\n\n\tBegin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.