slug
stringlengths
3
79
solution_id
stringlengths
13
89
primary_algorithm
stringclasses
22 values
verified
null
messages
listlengths
3
3
maximum-bitwise-and-after-increment-operations
maximum-bitwise-and-after-increment-operations__01__java
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums and two integers k and m.\n\nYou may p...
minimum-cost-to-repair-edges-to-traverse-a-graph
minimum-cost-to-repair-edges-to-traverse-a-graph__01__java
Binary Search
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an undirected graph with n nodes labeled from 0 to n - 1. Th...
best-reachable-tower
best-reachable-tower__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 integer array towers, where towers[i] = [xi, yi, qi] re...
minimum-operations-to-reach-target-array
minimum-operations-to-reach-target-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 two integer arrays nums and target, each of length n, where ...
number-of-alternating-xor-partitions
number-of-alternating-xor-partitions__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 distinct integers target1 and ...
minimum-edge-toggles-on-a-tree
minimum-edge-toggles-on-a-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 undirected tree with n nodes, numbered from 0 to n - 1. I...
vowel-consonant-score
vowel-consonant-score__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, spaces, ...
maximum-capacity-within-budget
maximum-capacity-within-budget__01__java
Sorting
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given two integer arrays costs and capacity, both of length n, whe...
design-auction-system
design-auction-system__01__java
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are asked to design an auction system that manages bids from multiple ...
lexicographically-smallest-string-after-deleting-duplicate-characters
lexicographically-smallest-string-after-deleting-duplicate-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 that consists of lowercase English letters.\n\nYo...
good-indices-in-a-digit-string
good-indices-in-a-digit-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 digits.\n\nAn index i is called goo...
minimum-prefix-removal-to-make-array-strictly-increasing
minimum-prefix-removal-to-make-array-strictly-increasing__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.\n\nYou need to remove exactly one pre...
rotate-non-negative-elements
rotate-non-negative-elements__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums and an integer k.\n\nRotate only the n...
pythagorean-distance-nodes-in-a-tree
pythagorean-distance-nodes-in-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 integer n and an undirected tree with n nodes numbered fr...
find-nth-smallest-integer-with-k-one-bits
find-nth-smallest-integer-with-k-one-bits__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 n and k.\n\nReturn an integer denoting...
design-order-management-system
design-order-management-system__01__java
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are asked to design a simple order management system for a trading pla...
reverse-letters-then-special-characters-in-a-string
reverse-letters-then-special-characters-in-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 consisting of lowercase English letters and speci...
minimum-k-to-reduce-array-within-limit
minimum-k-to-reduce-array-within-limit__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 array nums.\n\nFor a positive integer k, ...
longest-strictly-increasing-subsequence-with-non-zero-bitwise-and
longest-strictly-increasing-subsequence-with-non-zero-bitwise-and__01__java
Brute Force
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums.\n\nReturn the length of the longest s...
minimum-partition-score
minimum-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 an integer array nums and an integer k.\n\nYour task is to p...
count-monobit-integers
count-monobit-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 n.\n\nAn integer is called Monobit if all bits in...
final-element-after-subarray-deletions
final-element-after-subarray-deletions__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\nTwo players, Alice and Bob, play a...
design-ride-sharing-system
design-ride-sharing-system__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\nA ride sharing system manages ride requests from riders and availability f...
longest-alternating-subarray-after-removing-at-most-one-element
longest-alternating-subarray-after-removing-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\nA subarray nums[l..r] is alternati...
median-of-a-binary-search-tree-level
median-of-a-binary-search-tree-level__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 the root of a Binary Search Tree (BST) and an integer level....
count-dominant-indices
count-dominant-indices__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\nAn element at index i ...
merge-adjacent-equal-elements
merge-adjacent-equal-elements__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.\n\nYou must repeatedly apply the foll...
count-subarrays-with-cost-less-than-or-equal-to-k
count-subarrays-with-cost-less-than-or-equal-to-k__01__java
Two Pointers
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums, and an integer k.\n\nFor any subarray...
maximum-score-using-exactly-k-pairs
maximum-score-using-exactly-k-pairs__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 nums1 and nums2 of lengths n and m respec...
delayed-count-of-equal-elements
delayed-count-of-equal-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 of length n and an integer k.\n\nFor e...
weighted-word-mapping
weighted-word-mapping__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 strings words, where each string represents a wo...
number-of-prefix-connected-groups
number-of-prefix-connected-groups__01__java
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an array of strings words and an integer k.\n\nTwo words a a...
house-robber-v
house-robber-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 a professional robber planning to rob houses along a street. Each ...
palindromic-path-queries-in-a-tree
palindromic-path-queries-in-a-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 undirected tree with n nodes labeled 0 to n - 1. This is ...
toggle-light-bulbs
toggle-light-bulbs__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 bulbs of integers between 1 and 100.\n\nThere are 1...
first-element-with-unique-frequency
first-element-with-unique-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\nYou are given an integer array nums.\n\nReturn an integer denoting the fir...
longest-almost-palindromic-substring
longest-almost-palindromic-substring__01__java
Brute Force
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a string s consisting of lowercase English letters.\n\nA sub...
maximum-subarray-xor-with-bounded-range
maximum-subarray-xor-with-bounded-range__01__java
Sliding Window
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a non-negative integer array nums and an integer k.\n\nYou m...
total-distance-to-type-a-string-using-one-finger
total-distance-to-type-a-string-using-one-finger__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nThere is a special keyboard where keys are arranged in a rectangular grid ...
find-the-score-difference-in-a-game
find-the-score-difference-in-a-game__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, where nums[i] represents the points s...
check-digitorial-permutation
check-digitorial-permutation__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 number is called digitorial if the sum of...
maximum-bitwise-xor-after-rearrangement
maximum-bitwise-xor-after-rearrangement__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​​​​​​​, each of length n.\n\nYou ...
count-sequences-to-k
count-sequences-to-k__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, and an integer k.\n\nStart with an in...
maximum-requests-without-violating-the-limit
maximum-requests-without-violating-the-limit__01__java
Sliding Window
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 2D integer array requests, where requests[i] = [useri, tim...
smallest-pair-with-different-frequencies
smallest-pair-with-different-frequencies__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\nConsider all pairs of distinct val...
merge-close-characters
merge-close-characters__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 and an in...
minimum-operations-to-make-array-parity-alternating
minimum-operations-to-make-array-parity-alternating__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\nAn array is called parity alternat...
sum-of-k-digit-numbers-in-a-range
sum-of-k-digit-numbers-in-a-range__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 l, r, and k.\n\nConsider all possible integer...
trim-trailing-vowels
trim-trailing-vowels__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 that consists of lowercase English letters.\n\nRe...
minimum-cost-to-split-into-ones
minimum-cost-to-split-into-ones__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\nIn one operation, you may split an integer ...
minimum-bitwise-or-from-grid
minimum-bitwise-or-from-grid__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 2D integer array grid of size m x n.\n\nYou must select ex...
count-subarrays-with-k-distinct-integers
count-subarrays-with-k-distinct-integers__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 two integers k and m.\n\nReturn an...
unique-email-groups
unique-email-groups__01__java
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an array of strings emails, where each string is a valid ema...
minimum-capacity-box
minimum-capacity-box__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 capacity, where capacity[i] represents the ...
find-the-smallest-balanced-index
find-the-smallest-balanced-index__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.\n\nAn index i is balanced if the sum ...
minimum-operations-to-sort-a-string
minimum-operations-to-sort-a-string__01__java
String
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a string s consisting of lowercase English letters.\n\nIn on...
minimum-cost-to-partition-a-binary-string
minimum-cost-to-partition-a-binary-string__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 binary string s and two integers encCost and flatCost.\n\n...
reverse-k-subarrays
reverse-k-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 an integer array nums of length n and an integer k.\n\nYou m...
first-unique-even-element
first-unique-even-element__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\nReturn an integer denoting the fir...
sum-of-gcd-of-formed-pairs
sum-of-gcd-of-formed-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 integer array nums of length n.\n\nConstruct an array pre...
minimum-cost-to-equalize-arrays-using-swaps
minimum-cost-to-equalize-arrays-using-swaps__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 integer arrays nums1 and nums2 of size n.\n\nYou can per...
count-fancy-numbers-in-a-range
count-fancy-numbers-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 l and r.\n\nAn integer is called good if its di...
count-commas-in-range
count-commas-in-range__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\nReturn the total number of commas used when...
count-commas-in-range-ii
count-commas-in-range-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 integer n.\n\nReturn the total number of commas used when...
longest-arithmetic-sequence-after-changing-at-most-one-element
longest-arithmetic-sequence-after-changing-at-most-one-element__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.\n\nA subarray is arithmetic if the di...
maximum-points-activated-with-one-addition
maximum-points-activated-with-one-addition__01__java
Graph
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 2D integer array points, where points[i] = [xi, yi] repres...
valid-subarrays-with-exactly-one-peak
valid-subarrays-with-exactly-one-peak__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums of length n and an integer k.\n\nAn in...
construct-uniform-parity-array-i
construct-uniform-parity-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\nYou are given an array nums1 of n distinct integers.\n\nYou want to constr...
construct-uniform-parity-array-ii
construct-uniform-parity-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 nums1 of n distinct integers.\n\nYou want to constr...
minimum-removals-to-achieve-target-xor
minimum-removals-to-achieve-target-xor__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 target.\n\nYou may remo...
count-good-subarrays
count-good-subarrays__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 subarray is called good if the b...
maximum-distinct-path-sum-in-a-binary-tree
maximum-distinct-path-sum-in-a-binary-tree__01__java
DFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given the root of a binary tree, where each node contains an integ...
minimum-absolute-difference-between-two-values
minimum-absolute-difference-between-two-values__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 consisting only of 0, 1, and 2.\n\nA p...
direction-assignments-with-exactly-k-visible-people
direction-assignments-with-exactly-k-visible-people__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given three integers n, pos, and k.\n\nThere are n people standing...
minimum-xor-path-in-a-grid
minimum-xor-path-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 a 2D integer array grid of size m * n.\n\nYou start at the t...
count-non-decreasing-arrays-with-given-digit-sums
count-non-decreasing-arrays-with-given-digit-sums__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 digitSum of length n.\n\nAn array arr of le...
first-matching-character-from-both-ends
first-matching-character-from-both-ends__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 n consisting of lowercase English lette...
design-event-manager
design-event-manager__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 initial list of events, where each event has a unique eve...
sum-of-sortable-integers
sum-of-sortable-integers__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.\n\nAn integer k is called...
incremental-even-weighted-cycle-queries
incremental-even-weighted-cycle-queries__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.\n\nThere is an undirected graph with n...
minimum-operations-to-make-all-grid-elements-equal
minimum-operations-to-make-all-grid-elements-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 a 2D integer array grid of size m × n, and an integer ...
mirror-frequency-distance
mirror-frequency-distance__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 and digit...
integers-with-multiple-sum-of-two-cubes
integers-with-multiple-sum-of-two-cubes__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\nAn integer x is considered good if there ex...
minimum-increase-to-maximize-special-indices
minimum-increase-to-maximize-special-indices__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.\n\nAn index i (0 < i < n ...
minimum-operations-to-achieve-at-least-k-peaks
minimum-operations-to-achieve-at-least-k-peaks__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 ​​​​​​​circular integer array​​​​​​​ nums of length n.\n\n...
maximum-team-size-with-overlapping-intervals
maximum-team-size-with-overlapping-intervals__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 startTime and endTime of length n.\n\n\ts...
traffic-signal-color
traffic-signal-color__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 timer representing the remaining time (in seconds...
count-digit-appearances
count-digit-appearances__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 digit.\n\nReturn the to...
minimum-operations-to-transform-array-into-alternating-prime
minimum-operations-to-transform-array-into-alternating-prime__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\nAn array is considered alternating...
maximum-value-of-concatenated-binary-segments
maximum-value-of-concatenated-binary-segments__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 and nums0, each of size n.\n\n\tnum...
find-the-degree-of-each-vertex
find-the-degree-of-each-vertex__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 integer array matrix of size n x n representing the adj...
angles-of-a-triangle
angles-of-a-triangle__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 array sides of length 3.\n\nDetermine if ...
longest-balanced-substring-after-one-swap
longest-balanced-substring-after-one-swap__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 binary string s consisting only of characters '0' and '1'....
good-subsequence-queries
good-subsequence-queries__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums of length n and an integer p.\n\nA non...
zigzag-level-sum-of-binary-tree
zigzag-level-sum-of-binary-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 the root of a binary tree.\n\nTraverse the tree level by lev...
smallest-stable-index-i
smallest-stable-index-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 integer array nums of length n and an integer k.\n\nFor e...
smallest-stable-index-ii
smallest-stable-index-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 an integer array nums of length n and an integer k.\n\nFor e...
multi-source-flood-fill
multi-source-flood-fill__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 two integers n and m representing the number of rows and col...
count-good-integers-on-a-grid-path
count-good-integers-on-a-grid-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 two integers l and r, and a string directions consisting of ...
count-smaller-elements-with-opposite-parity
count-smaller-elements-with-opposite-parity__01__java
Brute Force
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums of length n.\n\nThe score of an index ...