slug stringlengths 3 79 | solution_id stringlengths 13 89 | primary_algorithm stringclasses 22
values | verified null | messages listlengths 3 3 |
|---|---|---|---|---|
compute-alternating-sum | compute-alternating-sum__01__java | Math | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer array nums.\n\nThe alternating sum of nums is the... |
longest-subsequence-with-non-zero-bitwise-xor | longest-subsequence-with-non-zero-bitwise-xor__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\nReturn the length of the longest s... |
remove-k-balanced-substrings | remove-k-balanced-substrings__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 '(' and ')', and an integer k.\n\nA... |
count-no-zero-pairs-that-sum-to-n | count-no-zero-pairs-that-sum-to-n__01__java | Dynamic Programming | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nA no-zero integer is a positive integer that does not contain the digit 0 ... |
equal-score-substrings | equal-score-substrings__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\nThe s... |
longest-fibonacci-subarray | longest-fibonacci-subarray__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.\n\nA Fibonacci array is ... |
design-exam-scores-tracker | design-exam-scores-tracker__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\nAlice frequently takes exams and wants to track her scores and calculate t... |
maximum-partition-factor | maximum-partition-factor__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 points, where points[i] = [xi, yi] repres... |
maximum-transactions-without-negative-balance | maximum-transactions-without-negative-balance__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 transactions, where transactions[i] represe... |
sum-of-elements-with-frequency-divisible-by-k | sum-of-elements-with-frequency-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 integer array nums and an integer k.\n\nReturn an integer... |
longest-balanced-substring-i | longest-balanced-substring-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\nA sub... |
longest-balanced-substring-ii | longest-balanced-substring-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 s consisting only of the characters 'a', 'b', and '... |
sum-of-perfect-square-ancestors | sum-of-perfect-square-ancestors__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 tree rooted at node 0 with n ... |
minimum-operations-to-make-the-array-beautiful | minimum-operations-to-make-the-array-beautiful__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\nAn array is called beautiful if fo... |
smallest-missing-multiple-of-k | smallest-missing-multiple-of-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\nGiven an integer array nums and an integer k, return the smallest positive... |
longest-balanced-subarray-i | longest-balanced-subarray-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 an integer array nums.\n\nA subarray is called balanced if t... |
lexicographically-smallest-permutation-greater-than-target | lexicographically-smallest-permutation-greater-than-target__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 s and target, both having length n, consisting o... |
longest-balanced-subarray-ii | longest-balanced-subarray-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 an integer array nums.\n\nA subarray is called balanced if t... |
lexicographically-smallest-string-after-reverse | lexicographically-smallest-string-after-reverse__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 of length n consisting of lowercase English lette... |
maximize-sum-of-squares-of-digits | maximize-sum-of-squares-of-digits__01__java | Greedy | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given two positive integers num and sum.\n\nA positive integer n i... |
minimum-operations-to-transform-array | minimum-operations-to-transform-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 two integer arrays nums1 of length n and nums2 of length n +... |
count-ways-to-choose-coprime-integers-from-rows | count-ways-to-choose-coprime-integers-from-rows__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 m x n matrix mat of positive integers.\n\nReturn an intege... |
remove-zeros-in-decimal-representation | remove-zeros-in-decimal-representation__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.\n\nReturn the integer obtained by remo... |
maximum-alternating-sum-of-squares | maximum-alternating-sum-of-squares__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. You may rearrange the elements in any... |
stable-subarrays-with-equal-boundary-and-interior-sum | stable-subarrays-with-equal-boundary-and-interior-sum__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 capacity.\n\nA subarray capacity[l..r] is c... |
count-distinct-subarrays-divisible-by-k-in-sorted-array | count-distinct-subarrays-divisible-by-k-in-sorted-array__01__java | Hash Table | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer array nums sorted in non-descending order and a p... |
maximum-calories-burnt-from-jumps | maximum-calories-burnt-from-jumps__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 heights of size n, where heights[i] represe... |
find-missing-elements | find-missing-elements__01__java | Hash Table | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer array nums consisting of unique integers.\n\nOrig... |
maximum-product-of-three-elements-after-one-replacement | maximum-product-of-three-elements-after-one-replacement__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.\n\nYou must replace exactly one eleme... |
minimum-time-to-complete-all-deliveries | minimum-time-to-complete-all-deliveries__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 integer arrays of size 2: d = [d1, d2] and r = [r1, r2].... |
lexicographically-smallest-palindromic-permutation-greater-than-target | lexicographically-smallest-palindromic-permutation-greater-than-target__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 target, each of length n, consisting of lo... |
lexicographically-smallest-string-after-reverse-ii | lexicographically-smallest-string-after-reverse-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 string s of length n consisting of lowercase English lette... |
minimum-moves-to-equal-array-elements-iii | minimum-moves-to-equal-array-elements-iii__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\nIn one move, you may increase the ... |
count-subarrays-with-majority-element-i | count-subarrays-with-majority-element-i__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 an integer array nums and an integer target.\n\nReturn the n... |
longest-non-decreasing-subarray-after-replacing-at-most-one-element | longest-non-decreasing-subarray-after-replacing-at-most-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 are allowed to replace at most... |
count-subarrays-with-majority-element-ii | count-subarrays-with-majority-element-ii__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 an integer array nums and an integer target.\n\nReturn the n... |
minimum-distance-between-three-equal-elements-i | minimum-distance-between-three-equal-elements-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 an integer array nums.\n\nA tuple (i, j, k) of 3 distinct in... |
minimum-distance-between-three-equal-elements-ii | minimum-distance-between-three-equal-elements-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 an integer array nums.\n\nA tuple (i, j, k) of 3 distinct in... |
maximum-path-score-in-a-grid | maximum-path-score-in-a-grid__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 m x n grid where each cell contains one of the values 0, ... |
maximize-cyclic-partition-score | maximize-cyclic-partition-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 a cyclic array nums and an integer k.\n\nPartition nums into... |
find-kth-character-in-expanded-string | find-kth-character-in-expanded-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 consisting of one or more words separated by sing... |
maximize-expression-of-three-elements | maximize-expression-of-three-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.\n\nChoose three elements a, b, and c ... |
minimum-string-length-after-balanced-removals | minimum-string-length-after-balanced-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 only of the characters 'a' and 'b'.\n\... |
count-distinct-integers-after-removing-zeros | count-distinct-integers-after-removing-zeros__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 positive integer n.\n\nFor every integer x from 1 to n, we... |
count-stable-subarrays | count-stable-subarrays__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 nums.\n\nA subarray of nums is called stabl... |
evaluate-valid-expressions | evaluate-valid-expressions__01__java | Recursion | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a string expression that represents a nested mathematical ex... |
minimum-number-of-flips-to-reverse-binary-string | minimum-number-of-flips-to-reverse-binary-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 positive integer n.\n\nLet s be the binary representation ... |
total-waviness-of-numbers-in-range-i | total-waviness-of-numbers-in-range-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 two integers num1 and num2 representing an inclusive range [... |
lexicographically-smallest-negated-permutation-that-sums-to-target | lexicographically-smallest-negated-permutation-that-sums-to-target__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 n and an integer target.\n\nReturn the le... |
total-waviness-of-numbers-in-range-ii | total-waviness-of-numbers-in-range-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 integers num1 and num2 representing an inclusive range [... |
concatenate-non-zero-digits-and-multiply-by-sum-i | concatenate-non-zero-digits-and-multiply-by-sum-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 an integer n.\n\nForm a new integer x by concatenating all t... |
find-maximum-balanced-xor-subarray-length | find-maximum-balanced-xor-subarray-length__01__java | Hash Table | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven an integer array nums, return the length of the longest subarray tha... |
concatenate-non-zero-digits-and-multiply-by-sum-ii | concatenate-non-zero-digits-and-multiply-by-sum-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 of length m consisting of digits. You are also gi... |
number-of-effective-subsequences | number-of-effective-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.\n\nThe strength of the array is defin... |
convert-number-words-to-digits | convert-number-words-to-digits__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 a string s consisting of lowercase English letters. s may co... |
count-elements-with-at-least-k-greater-values | count-elements-with-at-least-k-greater-values__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 of length n and an integer k.\n\nAn el... |
maximum-substrings-with-distinct-start | maximum-substrings-with-distinct-start__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\nRetur... |
minimum-absolute-distance-between-mirror-pairs | minimum-absolute-distance-between-mirror-pairs__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 mirror pair is a pair of indices... |
minimum-operations-to-equalize-subarrays | minimum-operations-to-equalize-subarrays__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 nums and an integer k.\n\nIn one operation,... |
maximum-total-sum-with-threshold-constraints | maximum-total-sum-with-threshold-constraints__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 nums and threshold, both of length n.\n\n... |
complete-prime-number | complete-prime-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\nYou are given an integer num.\n\nA number num is called a Complete Prime N... |
minimum-operations-to-make-binary-palindrome | minimum-operations-to-make-binary-palindrome__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 nums.\n\nFor each element nums[i], you may ... |
maximize-points-after-choosing-k-tasks | maximize-points-after-choosing-k-tasks__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, technique1 and technique2, each of lengt... |
minimum-inversion-count-in-subarrays-of-fixed-length | minimum-inversion-count-in-subarrays-of-fixed-length__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 of length n and an integer k.\n\nAn in... |
sort-integers-by-binary-reflection | sort-integers-by-binary-reflection__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.\n\nThe binary reflection of a positiv... |
largest-prime-from-consecutive-prime-sum | largest-prime-from-consecutive-prime-sum__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.\n\nReturn the largest prime number less than o... |
total-score-of-dungeon-runs | total-score-of-dungeon-runs__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 positive integer hp and two positive 1-indexed integer arr... |
maximum-subgraph-score-in-a-tree | maximum-subgraph-score-in-a-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 undirected tree with n nodes, numbered from 0 to n - 1. I... |
maximum-number-of-equal-length-runs | maximum-number-of-equal-length-runs__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\nA run... |
absolute-difference-between-maximum-and-minimum-k-elements | absolute-difference-between-maximum-and-minimum-k-elements__01__java | Sorting | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer array nums and an integer k.\n\nFind the absolute... |
reverse-words-with-same-vowel-count | reverse-words-with-same-vowel-count__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 lowercase English words, each separ... |
minimum-moves-to-balance-circular-array | minimum-moves-to-balance-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\nYou are given a circular array balance of length n, where balance[i] is th... |
minimum-deletions-to-make-alternating-substring | minimum-deletions-to-make-alternating-substring__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 of length n consisting only of the characters 'A'... |
minimum-distance-excluding-one-maximum-weighted-edge | minimum-distance-excluding-one-maximum-weighted-edge__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 positive integer n and a 2D integer array edges, where edg... |
minimum-number-of-operations-to-have-distinct-elements | minimum-number-of-operations-to-have-distinct-elements__01__java | Hash Table | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer array nums.\n\nIn one operation, you remove the f... |
maximum-sum-of-three-numbers-divisible-by-three | maximum-sum-of-three-numbers-divisible-by-three__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.\n\nYour task is to choose exactly thr... |
maximum-score-after-binary-swaps | maximum-score-after-binary-swaps__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 nums of length n and a binary string s of t... |
last-remaining-integer-after-alternating-deletion-operations | last-remaining-integer-after-alternating-deletion-operations__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 n.\n\nWe write the integers from 1 to n in a sequ... |
mirror-distance-of-an-integer | mirror-distance-of-an-integer__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 n.\n\nDefine its mirror distance as: abs(n - reve... |
minimum-deletion-cost-to-make-all-characters-equal | minimum-deletion-cost-to-make-all-characters-equal__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 of length n and an integer array cost of the same... |
minimum-swaps-to-avoid-forbidden-values | minimum-swaps-to-avoid-forbidden-values__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, nums and forbidden, each of length n.\n\... |
total-sum-of-interaction-cost-in-tree-groups | total-sum-of-interaction-cost-in-tree-groups__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 tree with n nodes numbered fr... |
find-diameter-endpoints-of-a-tree | find-diameter-endpoints-of-a-tree__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 undirected tree with n nodes, numbered from 0 to n - 1. I... |
maximum-score-of-a-split | maximum-score-of-a-split__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.\n\nChoose an index i such... |
minimum-cost-to-acquire-required-items | minimum-cost-to-acquire-required-items__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 five integers cost1, cost2, costBoth, need1, and need2.\n\nT... |
smallest-all-ones-multiple | smallest-all-ones-multiple__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 k.\n\nFind the smallest integer n divisib... |
number-of-balanced-integers-in-a-range | number-of-balanced-integers-in-a-range__01__java | Dynamic Programming | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given two integers low and high.\n\nAn integer is called balanced ... |
sum-of-increasing-product-blocks | sum-of-increasing-product-blocks__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 n.\n\nA sequence is formed as follows:\n\n\tThe 1... |
reverse-string-prefix | reverse-string-prefix__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 an integer k.\n\nReverse the first k characte... |
minimum-subarray-length-with-distinct-sum-at-least-k | minimum-subarray-length-with-distinct-sum-at-least-k__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.\n\nReturn the minimu... |
find-maximum-value-in-a-constrained-sequence | find-maximum-value-in-a-constrained-sequence__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 n, a 2D integer array restrictions, and an intege... |
count-routes-to-climb-a-rectangular-grid | count-routes-to-climb-a-rectangular-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 a string array grid of size n, where each string grid[i] has... |
largest-even-number | largest-even-number__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 only of the characters '1' and '2'.\n\... |
word-squares-ii | word-squares-ii__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\nYou are given a string array words, consisting of distinct 4-letter string... |
minimum-cost-to-make-two-binary-strings-equal | minimum-cost-to-make-two-binary-strings-equal__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 binary strings s and t, both of length n, and three posi... |
minimum-cost-to-merge-sorted-lists | minimum-cost-to-merge-sorted-lists__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 lists, where each lists[i] is a non-empty... |
number-of-ways-to-paint-sheets | number-of-ways-to-paint-sheets__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 n representing the number of sheets.\n\nYou are a... |
count-residue-prefixes | count-residue-prefixes__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 lowercase English letters.\n\n... |
number-of-centered-subarrays | number-of-centered-subarrays__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 subarray of nums is called cente... |
count-caesar-cipher-pairs | count-caesar-cipher-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 words of n strings. Each string has length m and co... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.