slug
stringlengths
3
79
solution_id
stringlengths
13
89
primary_algorithm
stringclasses
22 values
verified
null
messages
listlengths
3
3
binary-number-with-alternating-bits
binary-number-with-alternating-bits__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\nGiven a positive integer, check whether it has alternating bits: namely, i...
number-of-distinct-islands
number-of-distinct-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 an m x n binary matrix grid. An island is a group of 1's (re...
max-area-of-island
max-area-of-island__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 m x n binary matrix grid. An island is a group of 1's (re...
count-binary-substrings
count-binary-substrings__01__java
Two Pointers
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven a binary string s, return the number of non-empty substrings that ha...
degree-of-an-array
degree-of-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\nGiven a non-empty array of non-negative integers nums, the degree of this ...
partition-to-k-equal-sum-subsets
partition-to-k-equal-sum-subsets__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 an integer array nums and an integer k, return true if it is possibl...
partition-to-k-equal-sum-subsets
partition-to-k-equal-sum-subsets__02__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 an integer array nums and an integer k, return true if it is possibl...
partition-to-k-equal-sum-subsets
partition-to-k-equal-sum-subsets__03__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums and an integer k, return true if it is possibl...
falling-squares
falling-squares__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 several squares being dropped onto the X-axis of a 2D plane.\n\n...
search-in-a-binary-search-tree
search-in-a-binary-search-tree__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 the root of a binary search tree (BST) and an integer val.\n...
insert-into-a-binary-search-tree
insert-into-a-binary-search-tree__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 the root node of a binary search tree (BST) and a value to i...
search-in-a-sorted-array-of-unknown-size
search-in-a-sorted-array-of-unknown-size__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\nThis is an interactive problem.\n\nYou have a sorted array of unique eleme...
kth-largest-element-in-a-stream
kth-largest-element-in-a-stream__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 part of a university admissions office and need to keep track of t...
binary-search
binary-search__01__java
Binary Search
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven an array of integers nums which is sorted in ascending order, and an...
design-hashset
design-hashset__01__java
Linked List
null
[ { "role": "system", "content": "You 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 HashSet without using any built-in hash table libraries.\n\nImple...
design-hashset
design-hashset__02__java
Linked List
null
[ { "role": "system", "content": "You 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 HashSet without using any built-in hash table libraries.\n\nImple...
design-hashmap
design-hashmap__01__java
Linked List
null
[ { "role": "system", "content": "You 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 HashMap without using any built-in hash table libraries.\n\nImple...
design-linked-list
design-linked-list__01__java
Linked List
null
[ { "role": "system", "content": "You 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 your implementation of the linked list. You can choose to use a sin...
design-linked-list
design-linked-list__02__java
Linked List
null
[ { "role": "system", "content": "You 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 your implementation of the linked list. You can choose to use a sin...
insert-into-a-sorted-circular-linked-list
insert-into-a-sorted-circular-linked-list__01__java
Linked List
null
[ { "role": "system", "content": "You 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 Circular Linked List node, which is sorted in non-descending order...
to-lower-case
to-lower-case__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 string s, return the string after replacing every uppercase letter...
random-pick-with-blacklist
random-pick-with-blacklist__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 and an array of unique integers blacklist. Desi...
number-of-distinct-islands-ii
number-of-distinct-islands-ii__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 m x n binary matrix grid. An island is a group of 1's (re...
minimum-ascii-delete-sum-for-two-strings
minimum-ascii-delete-sum-for-two-strings__01__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven two strings s1 and s2, return the lowest ASCII sum of deleted charac...
subarray-product-less-than-k
subarray-product-less-than-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\nGiven an array of integers nums and an integer k, return the number of con...
best-time-to-buy-and-sell-stock-with-transaction-fee
best-time-to-buy-and-sell-stock-with-transaction-fee__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 prices where prices[i] is the price of a given stoc...
best-time-to-buy-and-sell-stock-with-transaction-fee
best-time-to-buy-and-sell-stock-with-transaction-fee__02__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an array prices where prices[i] is the price of a given stoc...
best-time-to-buy-and-sell-stock-with-transaction-fee
best-time-to-buy-and-sell-stock-with-transaction-fee__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 an array prices where prices[i] is the price of a given stoc...
range-module
range-module__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\nA Range Module is a module that tracks ranges of numbers. Design a data st...
max-stack
max-stack__01__java
Linked List
null
[ { "role": "system", "content": "You 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 max stack data structure that supports the stack operations and s...
1-bit-and-2-bit-characters
1-bit-and-2-bit-characters__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\nWe have two special characters:\n\n\tThe first character can be represente...
maximum-length-of-repeated-subarray
maximum-length-of-repeated-subarray__01__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven two integer arrays nums1 and nums2, return the maximum length of a s...
find-k-th-smallest-pair-distance
find-k-th-smallest-pair-distance__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\nThe distance of a pair of integers a and b is defined as the absolute diff...
longest-word-in-dictionary
longest-word-in-dictionary__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 representing an English Dictionary, return...
accounts-merge
accounts-merge__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 list of accounts where each element accounts[i] is a list of strin...
remove-comments
remove-comments__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 a C++ program, remove comments from it. The program source is an arr...
candy-crush
candy-crush__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\nThis question is about implementing a basic elimination algorithm for Cand...
find-pivot-index
find-pivot-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\nGiven an array of integers nums, calculate the pivot index of this array.\...
split-linked-list-in-parts
split-linked-list-in-parts__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 singly linked list and an integer k, split the linked ...
number-of-atoms
number-of-atoms__01__java
Sorting
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven a string formula representing a chemical formula, return the count o...
minimum-window-subsequence
minimum-window-subsequence__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 strings s1 and s2, return the minimum contiguous substring part of s...
self-dividing-numbers
self-dividing-numbers__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 self-dividing number is a number that is divisible by every digit it con...
my-calendar-i
my-calendar-i__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 implementing a program to use as your calendar. We can add a new e...
count-different-palindromic-subsequences
count-different-palindromic-subsequences__01__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven a string s, return the number of different non-empty palindromic sub...
my-calendar-ii
my-calendar-ii__01__java
Binary Search
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are implementing a program to use as your calendar. We can add a new e...
my-calendar-ii
my-calendar-ii__02__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 implementing a program to use as your calendar. We can add a new e...
my-calendar-iii
my-calendar-iii__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 k-booking happens when k events have some non-empty intersection (i.e., ...
flood-fill
flood-fill__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 image represented by an m x n grid of integers image, whe...
flood-fill
flood-fill__02__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 image represented by an m x n grid of integers image, whe...
sentence-similarity
sentence-similarity__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\nWe can represent a sentence as an array of words, for example, the sentenc...
asteroid-collision
asteroid-collision__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\nWe are given an array asteroids of integers representing asteroids in a ro...
parse-lisp-expression
parse-lisp-expression__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 expression representing a Lisp-like expression to r...
sentence-similarity-ii
sentence-similarity-ii__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\nWe can represent a sentence as an array of words, for example, the sentenc...
monotone-increasing-digits
monotone-increasing-digits__01__java
Greedy
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nAn integer has monotone increasing digits if and only if each pair of adja...
daily-temperatures
daily-temperatures__01__java
Array
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven an array of integers temperatures represents the daily temperatures,...
delete-and-earn
delete-and-earn__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. You want to maximize the number of po...
cherry-pickup
cherry-pickup__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 n x n grid representing a field of cherries, each cell is...
closest-leaf-in-a-binary-tree
closest-leaf-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\nGiven the root of a binary tree where every node has a unique value and a ...
network-delay-time
network-delay-time__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 network of n nodes, labeled from 1 to n. You are also give...
network-delay-time
network-delay-time__02__java
Heap
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given a network of n nodes, labeled from 1 to n. You are also give...
find-smallest-letter-greater-than-target
find-smallest-letter-greater-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\nYou are given an array of characters letters that is sorted in non-decreas...
prefix-and-suffix-search
prefix-and-suffix-search__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\nDesign a special dictionary that searches the words in it by a prefix and ...
prefix-and-suffix-search
prefix-and-suffix-search__02__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\nDesign a special dictionary that searches the words in it by a prefix and ...
min-cost-climbing-stairs
min-cost-climbing-stairs__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 cost where cost[i] is the cost of ith step ...
min-cost-climbing-stairs
min-cost-climbing-stairs__02__java
Dynamic Programming
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array cost where cost[i] is the cost of ith step ...
min-cost-climbing-stairs
min-cost-climbing-stairs__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 an integer array cost where cost[i] is the cost of ith step ...
largest-number-at-least-twice-of-others
largest-number-at-least-twice-of-others__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 where the largest integer is unique.\n...
shortest-completing-word
shortest-completing-word__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 licensePlate and an array of strings words, find the shorte...
contain-virus
contain-virus__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\nA virus is spreading rapidly, and your task is to quarantine the infected ...
number-of-corner-rectangles
number-of-corner-rectangles__01__java
Hash Table
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven an m x n integer matrix grid where each entry is only 0 or 1, return...
ip-to-cidr
ip-to-cidr__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\nAn IP address is a formatted 32-bit unsigned integer where each group of 8...
open-the-lock
open-the-lock__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 have a lock in front of you with 4 circular wheels. Each wheel has 10 ...
open-the-lock
open-the-lock__02__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 have a lock in front of you with 4 circular wheels. Each wheel has 10 ...
open-the-lock
open-the-lock__03__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 have a lock in front of you with 4 circular wheels. Each wheel has 10 ...
cracking-the-safe
cracking-the-safe__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 is a safe protected by a password. The password is a sequence of n d...
reach-a-number
reach-a-number__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nYou are standing at position 0 on an infinite number line. There is a dest...
pour-water
pour-water__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 elevation map represents as an integer array heights wher...
pyramid-transition-matrix
pyramid-transition-matrix__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 stacking blocks to form a pyramid. Each block has a color, which i...
set-intersection-size-at-least-two
set-intersection-size-at-least-two__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 intervals where intervals[i] = [starti, e...
bold-words-in-string
bold-words-in-string__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 keywords words and a string s, make all appearances of a...
employee-free-time
employee-free-time__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\nWe are given a list schedule of employees, which represents the working ti...
find-anagram-mappings
find-anagram-mappings__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 where nums2 is an anagram...
special-binary-string
special-binary-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\nSpecial binary strings are binary strings with the following two propertie...
prime-number-of-set-bits-in-binary-representation
prime-number-of-set-bits-in-binary-representation__01__java
Bit Manipulation
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nGiven two integers left and right, return the count of numbers in the incl...
partition-labels
partition-labels__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. We want to partition the string into as many par...
largest-plus-sign
largest-plus-sign__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. You have an n x n binary grid grid with all va...
couples-holding-hands
couples-holding-hands__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 are n couples sitting in 2n seats arranged in a row and want to hold...
toeplitz-matrix
toeplitz-matrix__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 m x n matrix, return true if the matrix is Toeplitz. Otherwise, r...
reorganize-string
reorganize-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\nGiven a string s, rearrange the characters of s so that any two adjacent c...
reorganize-string
reorganize-string__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 a string s, rearrange the characters of s so that any two adjacent c...
max-chunks-to-make-sorted-ii
max-chunks-to-make-sorted-ii__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 arr.\n\nWe split arr into some number of ch...
max-chunks-to-make-sorted
max-chunks-to-make-sorted__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 arr of length n that represents a permutati...
max-chunks-to-make-sorted
max-chunks-to-make-sorted__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\nYou are given an integer array arr of length n that represents a permutati...
basic-calculator-iv
basic-calculator-iv__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 expression such as expression = \"e + 8 - a + 5\" and an evaluati...
jewels-and-stones
jewels-and-stones__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're given strings jewels representing the types of stones that are jewe...
basic-calculator-iii
basic-calculator-iii__01__java
Math
null
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution." }, { "role": "user", "content": "### Problem\nImplement a basic calculator to evaluate a simple expression string.\n\nTh...
sliding-puzzle
sliding-puzzle__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\nOn an 2 x 3 board, there are five tiles labeled from 1 to 5, and an empty ...
sliding-puzzle
sliding-puzzle__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\nOn an 2 x 3 board, there are five tiles labeled from 1 to 5, and an empty ...
minimize-max-distance-to-gas-station
minimize-max-distance-to-gas-station__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 stations that represents the positions of t...
global-and-local-inversions
global-and-local-inversions__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 which represents a permuta...