slug
stringlengths
3
79
solution_id
stringlengths
13
89
primary_algorithm
stringclasses
22 values
verified
null
messages
listlengths
3
3
difference-of-number-of-distinct-values-on-diagonals
difference-of-number-of-distinct-values-on-diagonals__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven a 2D grid of size m x n, you should find the matrix answer of size m...
minimum-cost-to-make-all-characters-equal
minimum-cost-to-make-all-characters-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 0-indexed binary string s of length n on which you can app...
maximum-strictly-increasing-cells-in-a-matrix
maximum-strictly-increasing-cells-in-a-matrix__01__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven a 1-indexed m x n integer matrix mat, you can select any cell in the...
find-shortest-path-with-k-hops
find-shortest-path-with-k-hops__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 positive integer n which is the number of nodes of a 0-ind...
minimize-string-length
minimize-string-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 a string s, you have two types of operation:\n\n\tChoose an index i ...
semi-ordered-permutation
semi-ordered-permutation__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 permutation of n integers nums.\n\nA permutation...
sum-of-matrix-after-queries
sum-of-matrix-after-queries__01__java
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer n and a 0-indexed 2D array queries where queries[...
count-of-integers
count-of-integers__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 numeric strings num1 and num2 and two integers max_sum a...
count-houses-in-a-circular-street
count-houses-in-a-circular-street__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 object street of class Street that represents a circular ...
check-if-the-number-is-fascinating
check-if-the-number-is-fascinating__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 that consists of exactly 3 digits.\n\nWe call t...
find-the-longest-semi-repetitive-substring
find-the-longest-semi-repetitive-substring__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 digit string s that consists of digits from 0 to 9.\n\nA s...
find-the-longest-semi-repetitive-substring
find-the-longest-semi-repetitive-substring__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 a digit string s that consists of digits from 0 to 9.\n\nA s...
movement-of-robots
movement-of-robots__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\nSome robots are standing on an infinite number line with their initial coo...
find-a-good-subset-of-the-matrix
find-a-good-subset-of-the-matrix__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 0-indexed m x n binary matrix grid.\n\nLet us call a non-e...
neither-minimum-nor-maximum
neither-minimum-nor-maximum__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 array nums containing distinct positive integers, find an...
lexicographically-smallest-string-after-substring-operation
lexicographically-smallest-string-after-substring-operation__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 string s consisting of lowercase English letters. Perform the foll...
collecting-chocolates
collecting-chocolates__01__java
Array
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array nums of size n representing the co...
maximum-sum-queries
maximum-sum-queries__01__java
Binary Search
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given two 0-indexed integer arrays nums1 and nums2, each of length...
find-the-closest-marked-node
find-the-closest-marked-node__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 positive integer n which is the number of nodes of a 0-ind...
total-distance-traveled
total-distance-traveled__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 truck has two fuel tanks. You are given two integers, mainTank represent...
find-the-value-of-the-partition
find-the-value-of-the-partition__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 nums.\n\nPartition nums into two ar...
special-permutations
special-permutations__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 integer array nums containing n distinct positiv...
painting-the-walls
painting-the-walls__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 0-indexed integer arrays, cost and time, of size n repre...
count-substrings-without-repeating-character
count-substrings-without-repeating-character__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 consisting only of lowercase English letters. We ...
find-maximum-number-of-string-pairs
find-maximum-number-of-string-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 a 0-indexed array words consisting of distinct strings.\n\nT...
construct-the-longest-new-string
construct-the-longest-new-string__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 three integers x, y, and z.\n\nYou have x strings equal to \...
decremental-string-concatenation
decremental-string-concatenation__01__java
Memoization
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed array words containing n strings.\n\nLet's defin...
count-zero-request-servers
count-zero-request-servers__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 n denoting the total number of servers and a 2D 0...
number-of-beautiful-pairs
number-of-beautiful-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 a 0-indexed integer array nums. A pair of indices i, j where...
minimum-operations-to-make-the-integer-zero
minimum-operations-to-make-the-integer-zero__01__java
Bit Manipulation
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given two integers num1 and num2.\n\nIn one operation, you can cho...
ways-to-split-array-into-good-subarrays
ways-to-split-array-into-good-subarrays__01__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a binary array nums.\n\nA subarray of an array is good if it...
count-houses-in-a-circular-street-ii
count-houses-in-a-circular-street-ii__01__java
Brute Force
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an object street of class Street that represents a circular ...
longest-even-odd-subarray-with-threshold
longest-even-odd-subarray-with-threshold__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 0-indexed integer array nums and an integer threshold.\n\n...
longest-even-odd-subarray-with-threshold
longest-even-odd-subarray-with-threshold__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 a 0-indexed integer array nums and an integer threshold.\n\n...
prime-pairs-with-target-sum
prime-pairs-with-target-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 n. We say that two integers x and y form a prime ...
continuous-subarrays
continuous-subarrays__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 0-indexed integer array nums. A subarray of nums is called...
sum-of-imbalance-numbers-of-all-subarrays
sum-of-imbalance-numbers-of-all-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\nThe imbalance number of a 0-indexed integer array arr of length n is defin...
is-array-a-preorder-of-some-binary-tree
is-array-a-preorder-of-some-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\nGiven a 0-indexed integer 2D array nodes, your task is to determine if the...
longest-alternating-subarray
longest-alternating-subarray__01__java
Array
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array nums. A subarray s of length m is ...
relocate-marbles
relocate-marbles__01__java
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array nums representing the initial posi...
partition-string-into-minimum-beautiful-substrings
partition-string-into-minimum-beautiful-substrings__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\nGiven a binary string s, partition the string into one or more substrings ...
number-of-black-blocks
number-of-black-blocks__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 integers m and n representing the dimensions of a 0-inde...
find-the-maximum-achievable-number
find-the-maximum-achievable-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\nGiven two integers, num and t. A number x is achievable if it can become e...
maximum-number-of-jumps-to-reach-the-last-index
maximum-number-of-jumps-to-reach-the-last-index__01__java
Memoization
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed array nums of n integers and an integer target.\...
longest-non-decreasing-subarray-from-two-arrays
longest-non-decreasing-subarray-from-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 0-indexed integer arrays nums1 and nums2 of length n.\n\...
apply-operations-to-make-all-array-elements-equal-to-zero
apply-operations-to-make-all-array-elements-equal-to-zero__01__java
Array
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array nums and a positive integer k.\n\n...
height-of-special-binary-tree
height-of-special-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 a root, which is the root of a special binary tree with n no...
sum-of-squares-of-special-elements
sum-of-squares-of-special-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 a 1-indexed integer array nums of length n.\n\nAn element nu...
maximum-beauty-of-an-array-after-applying-operation
maximum-beauty-of-an-array-after-applying-operation__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 0-indexed array nums and a non-negative integer k.\n\nIn o...
minimum-index-of-a-valid-split
minimum-index-of-a-valid-split__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\nAn element x of an integer array arr of length m is dominant if more than ...
length-of-the-longest-valid-substring
length-of-the-longest-valid-substring__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 string word and an array of strings forbidden.\n\nA string...
number-of-unique-categories
number-of-unique-categories__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 an integer n and an object categoryHandler of class Category...
check-if-array-is-good
check-if-array-is-good__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. We consider an array good if it is a ...
sort-vowels-in-a-string
sort-vowels-in-a-string__01__java
Sorting
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven a 0-indexed string s, permute s to get a new string t such that:\n\n...
visit-array-positions-to-maximize-score
visit-array-positions-to-maximize-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 0-indexed integer array nums and a positive integer x.\n\n...
ways-to-express-an-integer-as-sum-of-powers
ways-to-express-an-integer-as-sum-of-powers__01__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven two positive integers n and x.\n\nReturn the number of ways n can be...
split-strings-by-separator
split-strings-by-separator__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven an array of strings words and a character separator, split each stri...
largest-element-in-an-array-after-merge-operations
largest-element-in-an-array-after-merge-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 a 0-indexed array nums consisting of positive integers.\n\nY...
maximum-number-of-groups-with-increasing-length
maximum-number-of-groups-with-increasing-length__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 0-indexed array usageLimits of length n.\n\nYour task is t...
count-paths-that-can-form-a-palindrome-in-a-tree
count-paths-that-can-form-a-palindrome-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 a tree (i.e. a connected, undirected graph that has no cycle...
count-nodes-that-are-great-enough
count-nodes-that-are-great-enough__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 root to a binary tree and an integer k. A node of this tre...
number-of-employees-who-met-the-target
number-of-employees-who-met-the-target__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\nThere are n employees in a company, numbered from 0 to n - 1. Each employe...
count-complete-subarrays-in-an-array
count-complete-subarrays-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 consisting of positive integers.\n\nWe call a ...
count-complete-subarrays-in-an-array
count-complete-subarrays-in-an-array__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 an array nums consisting of positive integers.\n\nWe call a ...
shortest-string-that-contains-three-strings
shortest-string-that-contains-three-strings__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 three strings a, b, and c, your task is to find a string that has th...
shortest-string-that-contains-three-strings
shortest-string-that-contains-three-strings__02__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 three strings a, b, and c, your task is to find a string that has th...
count-stepping-numbers-in-range
count-stepping-numbers-in-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\nGiven two positive integers low and high represented as strings, find the ...
find-the-k-th-lucky-number
find-the-k-th-lucky-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\nWe know that 4 and 7 are lucky digits. Also, a number is called lucky if i...
account-balance-after-rounded-purchase
account-balance-after-rounded-purchase__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\nInitially, you have a bank account balance of 100 dollars.\n\nYou are give...
insert-greatest-common-divisors-in-linked-list
insert-greatest-common-divisors-in-linked-list__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 the head of a linked list head, in which each node contains an integ...
minimum-seconds-to-equalize-a-circular-array
minimum-seconds-to-equalize-a-circular-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 a 0-indexed array nums containing n integers.\n\nAt each sec...
minimum-time-to-make-array-sum-at-most-x
minimum-time-to-make-array-sum-at-most-x__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 0-indexed integer arrays nums1 and nums2 of equal length...
faulty-keyboard
faulty-keyboard__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\nYour laptop keyboard is faulty, and whenever you type a character 'i' on i...
check-if-it-is-possible-to-split-array
check-if-it-is-possible-to-split-array__01__java
Memoization
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an array nums of length n and an integer m. You need to dete...
find-the-safest-path-in-a-grid
find-the-safest-path-in-a-grid__01__java
BFS
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed 2D matrix grid of size n x n, where (r, c) repre...
maximum-elegance-of-a-k-length-subsequence
maximum-elegance-of-a-k-length-subsequence__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 0-indexed 2D integer array items of length n and an intege...
minimum-time-takes-to-reach-destination-without-drowning
minimum-time-takes-to-reach-destination-without-drowning__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 n * m 0-indexed grid of string land. Right now, you are s...
max-pair-sum-in-an-array
max-pair-sum-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 integer array nums. You have to find the maximum sum of a...
double-a-number-represented-as-a-linked-list
double-a-number-represented-as-a-linked-list__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 the head of a non-empty linked list representing a non-negat...
minimum-absolute-difference-between-elements-with-constraint
minimum-absolute-difference-between-elements-with-constraint__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 0-indexed integer array nums and an integer x.\n\nFind the...
apply-operations-to-maximize-score
apply-operations-to-maximize-score__01__java
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an array nums of n positive integers and an integer k.\n\nIn...
minimum-relative-loss-after-buying-chocolates
minimum-relative-loss-after-buying-chocolates__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 prices, which shows the chocolate prices an...
count-pairs-whose-sum-is-less-than-target
count-pairs-whose-sum-is-less-than-target__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 a 0-indexed integer array nums of length n and an integer target, re...
make-string-a-subsequence-using-cyclic-increments
make-string-a-subsequence-using-cyclic-increments__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 0-indexed strings str1 and str2.\n\nIn an operation, you...
sorting-three-groups
sorting-three-groups__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. Each element in nums is 1, 2 or 3. In...
number-of-beautiful-integers-in-the-range
number-of-beautiful-integers-in-the-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 positive integers low, high, and k.\n\nA number is beautiful...
check-if-a-string-is-an-acronym-of-words
check-if-a-string-is-an-acronym-of-words__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven an array of strings words and a string s, determine if s is an acron...
check-if-a-string-is-an-acronym-of-words
check-if-a-string-is-an-acronym-of-words__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\nGiven an array of strings words and a string s, determine if s is an acron...
determine-the-minimum-sum-of-a-k-avoiding-array
determine-the-minimum-sum-of-a-k-avoiding-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 integers, n and k.\n\nAn array of distinct positive inte...
maximize-the-profit-as-the-salesman
maximize-the-profit-as-the-salesman__01__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer n representing the number of houses on a number l...
find-the-longest-equal-subarray
find-the-longest-equal-subarray__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 0-indexed integer array nums and an integer k.\n\nA subarr...
find-the-longest-equal-subarray
find-the-longest-equal-subarray__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 a 0-indexed integer array nums and an integer k.\n\nA subarr...
maximal-range-that-each-element-is-maximum-in-it
maximal-range-that-each-element-is-maximum-in-it__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 array nums of distinct integers.\n\nLet us defin...
furthest-point-from-origin
furthest-point-from-origin__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 moves of length n consisting only of characters 'L'...
find-the-minimum-possible-sum-of-a-beautiful-array
find-the-minimum-possible-sum-of-a-beautiful-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 positive integers n and target.\n\nAn array nums is beautifu...
minimum-operations-to-form-subsequence-with-target-sum
minimum-operations-to-form-subsequence-with-target-sum__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 0-indexed array nums consisting of non-negative powers of ...
maximize-value-of-function-in-a-ball-passing-game
maximize-value-of-function-in-a-ball-passing-game__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 receiver of length n and an integer k. n pl...
maximum-coins-heroes-can-collect
maximum-coins-heroes-can-collect__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 battle and n heroes are trying to defeat m monsters. You are gi...
check-if-strings-can-be-made-equal-with-operations-i
check-if-strings-can-be-made-equal-with-operations-i__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 two strings s1 and s2, both of length 4, consisting of lower...
check-if-strings-can-be-made-equal-with-operations-ii
check-if-strings-can-be-made-equal-with-operations-ii__01__java
Sorting
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given two strings s1 and s2, both of length n, consisting of lower...