slug
stringlengths
3
79
solution_id
stringlengths
13
89
primary_algorithm
stringclasses
22 values
verified
null
messages
listlengths
3
3
evaluate-the-bracket-pairs-of-a-string
evaluate-the-bracket-pairs-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 that contains some bracket pairs, with each pair ...
maximize-number-of-nice-divisors
maximize-number-of-nice-divisors__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 primeFactors. You are asked to construct ...
minimum-path-cost-in-a-hidden-grid
minimum-path-cost-in-a-hidden-grid__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\nThis is an interactive problem.\n\nThere is a robot in a hidden grid, and ...
determine-color-of-a-chessboard-square
determine-color-of-a-chessboard-square__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 coordinates, a string that represents the coordinates of a s...
sentence-similarity-iii
sentence-similarity-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\nYou are given two strings sentence1 and sentence2, each representing a sen...
count-nice-pairs-in-an-array
count-nice-pairs-in-an-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 array nums that consists of non-negative integers. Let us...
count-nice-pairs-in-an-array
count-nice-pairs-in-an-array__02__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 that consists of non-negative integers. Let us...
maximum-number-of-groups-getting-fresh-donuts
maximum-number-of-groups-getting-fresh-donuts__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 a donuts shop that bakes donuts in batches of batchSize. They hav...
truncate-sentence
truncate-sentence__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 sentence is a list of words that are separated by a single space with no...
finding-the-users-active-minutes
finding-the-users-active-minutes__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 the logs for users' actions on LeetCode, and an integer k. T...
minimum-absolute-sum-difference
minimum-absolute-sum-difference__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 positive integer arrays nums1 and nums2, both of length ...
number-of-different-subsequences-gcds
number-of-different-subsequences-gcds__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 that consists of positive integers.\n\nThe GCD...
maximum-number-of-accepted-invitations
maximum-number-of-accepted-invitations__01__java
DFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nThere are m boys and n girls in a class attending an upcoming party.\n\nYo...
sign-of-the-product-of-an-array
sign-of-the-product-of-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\nImplement a function signFunc(x) that returns:\n\n\t1 if x is positive.\n\...
find-the-winner-of-the-circular-game
find-the-winner-of-the-circular-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\nThere are n friends that are playing a game. The friends are sitting in a ...
minimum-sideway-jumps
minimum-sideway-jumps__01__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nThere is a 3 lane road of length n that consists of n + 1 points labeled f...
finding-mk-average
finding-mk-average__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 two integers, m and k, and a stream of integers. You are tas...
faulty-sensor
faulty-sensor__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\nAn experiment is being conducted in a lab. To ensure accuracy, there are t...
minimum-operations-to-make-the-array-increasing
minimum-operations-to-make-the-array-increasing__01__java
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums (0-indexed). In one operation, you can...
queries-on-number-of-points-inside-a-circle
queries-on-number-of-points-inside-a-circle__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 points where points[i] = [xi, yi] is the coordinate...
maximum-xor-for-each-query
maximum-xor-for-each-query__01__java
Bit Manipulation
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a sorted array nums of n non-negative integers and an intege...
maximum-xor-for-each-query
maximum-xor-for-each-query__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 a sorted array nums of n non-negative integers and an intege...
minimum-number-of-operations-to-make-string-sorted
minimum-number-of-operations-to-make-string-sorted__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 (0-indexed)​​​​​​. You are asked to perform the f...
check-if-the-sentence-is-pangram
check-if-the-sentence-is-pangram__01__java
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nA pangram is a sentence where every letter of the English alphabet appears...
check-if-the-sentence-is-pangram
check-if-the-sentence-is-pangram__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\nA pangram is a sentence where every letter of the English alphabet appears...
maximum-ice-cream-bars
maximum-ice-cream-bars__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\nIt is a sweltering summer day, and a boy wants to buy some ice cream bars....
single-threaded-cpu
single-threaded-cpu__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 n​​​​​​ tasks labeled from 0 to n - 1 represented by a 2D in...
find-xor-sum-of-all-pairs-bitwise-and
find-xor-sum-of-all-pairs-bitwise-and__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\nThe XOR sum of a list is the bitwise XOR of all its elements. If the list ...
remove-duplicates-from-an-unsorted-linked-list
remove-duplicates-from-an-unsorted-linked-list__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, find all the values that appear more than...
sum-of-digits-in-base-k
sum-of-digits-in-base-k__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven an integer n (in base 10) and a base k, return the sum of the digits...
frequency-of-the-most-frequent-element
frequency-of-the-most-frequent-element__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 frequency of an element is the number of times it occurs in an array.\...
frequency-of-the-most-frequent-element
frequency-of-the-most-frequent-element__02__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\nThe frequency of an element is the number of times it occurs in an array.\...
longest-substring-of-all-vowels-in-order
longest-substring-of-all-vowels-in-order__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\nA string is considered beautiful if it satisfies the following conditions:...
maximum-building-height
maximum-building-height__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 want to build n new buildings in a city. The new buildings will be bui...
next-palindrome-using-same-digits
next-palindrome-using-same-digits__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 numeric string num, representing a very large palindrome.\...
replace-all-digits-with-characters
replace-all-digits-with-characters__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 0-indexed string s that has lowercase English letters in i...
seat-reservation-manager
seat-reservation-manager__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\nDesign a system that manages the reservation state of n seats that are num...
maximum-element-after-decreasing-and-rearranging
maximum-element-after-decreasing-and-rearranging__01__java
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an array of positive integers arr. Perform some operations (...
closest-room
closest-room__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 is a hotel with n rooms. The rooms are represented by a 2D integer a...
minimum-distance-to-the-target-element
minimum-distance-to-the-target-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\nGiven an integer array nums (0-indexed) and two integers target and start,...
splitting-a-string-into-descending-consecutive-values
splitting-a-string-into-descending-consecutive-values__01__java
DFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a string s that consists of only digits.\n\nCheck if we can ...
minimum-adjacent-swaps-to-reach-the-kth-smallest-number
minimum-adjacent-swaps-to-reach-the-kth-smallest-number__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 num, representing a large integer, and an integer k...
minimum-interval-to-include-each-query
minimum-interval-to-include-each-query__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 integer array intervals, where intervals[i] = [lefti, r...
distinct-numbers-in-each-subarray
distinct-numbers-in-each-subarray__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. Your tas...
distinct-numbers-in-each-subarray
distinct-numbers-in-each-subarray__02__java
Sliding Window
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums of length n and an integer k. Your tas...
maximum-population-year
maximum-population-year__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 logs where each logs[i] = [birthi, deathi...
maximum-distance-between-a-pair-of-values
maximum-distance-between-a-pair-of-values__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 non-increasing 0-indexed integer arrays nums1​​​​​​ and ...
maximum-distance-between-a-pair-of-values
maximum-distance-between-a-pair-of-values__02__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 non-increasing 0-indexed integer arrays nums1​​​​​​ and ...
maximum-subarray-min-product
maximum-subarray-min-product__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\nThe min-product of an array is equal to the minimum value in the array mul...
largest-color-value-in-a-directed-graph
largest-color-value-in-a-directed-graph__01__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nThere is a directed graph of n colored nodes and m edges. The nodes are nu...
longest-word-with-all-prefixes
longest-word-with-all-prefixes__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\nGiven an array of strings words, find the longest string in words such tha...
sorting-the-sentence
sorting-the-sentence__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 sentence is a list of words that are separated by a single space with no...
incremental-memory-leak
incremental-memory-leak__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 memory1 and memory2 representing the available ...
rotating-the-box
rotating-the-box__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an m x n matrix of characters boxGrid representing a side-vi...
sum-of-floored-pairs
sum-of-floored-pairs__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 integer array nums, return the sum of floor(nums[i] / nums[j]) fo...
sum-of-all-subset-xor-totals
sum-of-all-subset-xor-totals__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\nThe XOR total of an array is defined as the bitwise XOR of all its element...
sum-of-all-subset-xor-totals
sum-of-all-subset-xor-totals__02__java
DFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nThe XOR total of an array is defined as the bitwise XOR of all its element...
minimum-number-of-swaps-to-make-the-binary-string-alternating
minimum-number-of-swaps-to-make-the-binary-string-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\nGiven a binary string s, return the minimum number of character swaps to m...
finding-pairs-with-a-certain-sum
finding-pairs-with-a-certain-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 two integer arrays nums1 and nums2. You are tasked to implem...
number-of-ways-to-rearrange-sticks-with-k-sticks-visible
number-of-ways-to-rearrange-sticks-with-k-sticks-visible__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 are n uniquely-sized sticks whose lengths are integers from 1 to n. ...
number-of-ways-to-rearrange-sticks-with-k-sticks-visible
number-of-ways-to-rearrange-sticks-with-k-sticks-visible__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\nThere are n uniquely-sized sticks whose lengths are integers from 1 to n. ...
product-of-two-run-length-encoded-arrays
product-of-two-run-length-encoded-arrays__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\nRun-length encoding is a compression algorithm that allows for an integer ...
longer-contiguous-segments-of-ones-than-zeros
longer-contiguous-segments-of-ones-than-zeros__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\nGiven a binary string s, return true if the longest contiguous segment of ...
minimum-speed-to-arrive-on-time
minimum-speed-to-arrive-on-time__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 floating-point number hour, representing the amount of tim...
jump-game-vii
jump-game-vii__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 0-indexed binary string s and two integers minJump and max...
stone-game-viii
stone-game-viii__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\nAlice and Bob take turns playing a game, with Alice starting first.\n\nThe...
stone-game-viii
stone-game-viii__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\nAlice and Bob take turns playing a game, with Alice starting first.\n\nThe...
minimize-product-sum-of-two-arrays
minimize-product-sum-of-two-arrays__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\nThe product sum of two equal-length arrays a and b is equal to the sum of ...
substrings-of-size-three-with-distinct-characters
substrings-of-size-three-with-distinct-characters__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\nA string is good if there are no repeated characters.\n\nGiven a string s​...
minimize-maximum-pair-sum-in-array
minimize-maximum-pair-sum-in-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\nThe pair sum of a pair (a,b) is equal to a + b. The maximum pair sum is th...
get-biggest-three-rhombus-sums-in-a-grid
get-biggest-three-rhombus-sums-in-a-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 an m x n integer matrix grid​​​.\n\nA rhombus sum is the sum...
minimum-xor-sum-of-two-arrays
minimum-xor-sum-of-two-arrays__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 length n.\n\nThe XOR s...
minimum-xor-sum-of-two-arrays
minimum-xor-sum-of-two-arrays__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 two integer arrays nums1 and nums2 of length n.\n\nThe XOR s...
minimum-xor-sum-of-two-arrays
minimum-xor-sum-of-two-arrays__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\nYou are given two integer arrays nums1 and nums2 of length n.\n\nThe XOR s...
check-if-word-equals-summation-of-two-words
check-if-word-equals-summation-of-two-words__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\nThe letter value of a letter is its position in the alphabet starting from...
maximum-value-after-insertion
maximum-value-after-insertion__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 very large integer n, represented as a string,​​​​​​ and a...
process-tasks-using-servers
process-tasks-using-servers__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 two 0-indexed integer arrays servers and tasks of lengths n​...
minimum-skips-to-arrive-at-meeting-on-time
minimum-skips-to-arrive-at-meeting-on-time__01__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer hoursBefore, the number of hours you have to trav...
egg-drop-with-2-eggs-and-n-floors
egg-drop-with-2-eggs-and-n-floors__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 identical eggs and you have access to a building with n ...
count-pairs-in-two-arrays
count-pairs-in-two-arrays__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 two integer arrays nums1 and nums2 of length n, count the pairs of i...
determine-whether-matrix-can-be-obtained-by-rotation
determine-whether-matrix-can-be-obtained-by-rotation__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 two n x n binary matrices mat and target, return true if it is possi...
reduction-operations-to-make-the-array-elements-equal
reduction-operations-to-make-the-array-elements-equal__01__java
Sorting
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums, your goal is to make all elements in nums equ...
minimum-number-of-flips-to-make-the-binary-string-alternating
minimum-number-of-flips-to-make-the-binary-string-alternating__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 binary string s. You are allowed to perform two types of o...
minimum-space-wasted-from-packaging
minimum-space-wasted-from-packaging__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 have n packages that you are trying to place in boxes, one package in ...
cutting-ribbons
cutting-ribbons__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 ribbons, where ribbons[i] represents the le...
check-if-all-the-integers-in-a-range-are-covered
check-if-all-the-integers-in-a-range-are-covered__01__java
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 2D integer array ranges and two integers left and right. E...
find-the-student-that-will-replace-the-chalk
find-the-student-that-will-replace-the-chalk__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 are n students in a class numbered from 0 to n - 1. The teacher will...
largest-magic-square
largest-magic-square__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\nA k x k magic square is a k x k grid filled with integers such that every ...
minimum-cost-to-change-the-final-value-of-expression
minimum-cost-to-change-the-final-value-of-expression__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 valid boolean expression as a string expression consisting...
redistribute-characters-to-make-all-strings-equal
redistribute-characters-to-make-all-strings-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 an array of strings words (0-indexed).\n\nIn one operation, ...
maximum-number-of-removable-characters
maximum-number-of-removable-characters__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 strings s and p where p is a subsequence of s. You are a...
merge-triplets-to-form-target-triplet
merge-triplets-to-form-target-triplet__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\nA triplet is an array of three integers. You are given a 2D integer array ...
the-earliest-and-latest-rounds-where-players-compete
the-earliest-and-latest-rounds-where-players-compete__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\nThere is a tournament where n players are participating. The players are s...
find-a-peak-element-ii
find-a-peak-element-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\nA peak element in a 2D grid is an element that is strictly greater than al...
depth-of-bst-given-insertion-order
depth-of-bst-given-insertion-order__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 order of length n, a permutation o...
largest-odd-number-in-string
largest-odd-number-in-string__01__java
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a string num, representing a large integer. Return the large...
the-number-of-full-rounds-you-have-played
the-number-of-full-rounds-you-have-played__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 participating in an online chess tournament. There is a chess roun...
count-sub-islands
count-sub-islands__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 two m x n binary matrices grid1 and grid2 containing only 0'...
minimum-absolute-difference-queries
minimum-absolute-difference-queries__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\nThe minimum absolute difference of an array a is defined as the minimum va...
game-of-nim
game-of-nim__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\nAlice and Bob take turns playing a game with Alice starting first.\n\nIn t...