slug stringlengths 3 79 | solution_id stringlengths 13 89 | primary_algorithm stringclasses 22
values | verified null | messages listlengths 3 3 |
|---|---|---|---|---|
maximum-product-subarray | maximum-product-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 an integer array nums, find a subarray that has the largest product,... |
find-minimum-in-rotated-sorted-array | find-minimum-in-rotated-sorted-array__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\nSuppose an array of length n sorted in ascending order is rotated between ... |
find-minimum-in-rotated-sorted-array-ii | find-minimum-in-rotated-sorted-array-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\nSuppose an array of length n sorted in ascending order is rotated between ... |
min-stack | min-stack__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\nDesign a stack that supports push, pop, top, and retrieving the minimum el... |
binary-tree-upside-down | binary-tree-upside-down__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, turn the tree upside down and return the ... |
read-n-characters-given-read4 | read-n-characters-given-read4__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 file and assume that you can only read the file using a given meth... |
read-n-characters-given-read4-ii-call-multiple-times | read-n-characters-given-read4-ii-call-multiple-times__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 file and assume that you can only read the file using a given meth... |
longest-substring-with-at-most-two-distinct-characters | longest-substring-with-at-most-two-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\nGiven a string s, return the length of the longest substring that contains... |
intersection-of-two-linked-lists | intersection-of-two-linked-lists__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 the heads of two singly linked-lists headA and headB, return the nod... |
one-edit-distance | one-edit-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\nGiven two strings s and t, return true if they are both one edit distance ... |
find-peak-element | find-peak-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\nA peak element is an element that is strictly greater than its neighbors.\... |
missing-ranges | missing-ranges__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 inclusive range [lower, upper] and a sorted unique intege... |
maximum-gap | maximum-gap__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, return the maximum difference between two suc... |
compare-version-numbers | compare-version-numbers__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 version strings, version1 and version2, compare them. A version ... |
fraction-to-recurring-decimal | fraction-to-recurring-decimal__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 representing the numerator and denominator of a fractio... |
two-sum-ii-input-array-is-sorted | two-sum-ii-input-array-is-sorted__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 1-indexed array of integers numbers that is already sorted in non-... |
two-sum-ii-input-array-is-sorted | two-sum-ii-input-array-is-sorted__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\nGiven a 1-indexed array of integers numbers that is already sorted in non-... |
excel-sheet-column-title | excel-sheet-column-title__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 columnNumber, return its corresponding column title as it... |
majority-element | majority-element__01__java | Divide and Conquer | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven an array nums of size n, return the majority element.\n\nThe majorit... |
two-sum-iii-data-structure-design | two-sum-iii-data-structure-design__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\nDesign a data structure that accepts a stream of integers and checks if it... |
excel-sheet-column-number | excel-sheet-column-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 a string columnTitle that represents the column title as appears in ... |
factorial-trailing-zeroes | factorial-trailing-zeroes__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, return the number of trailing zeroes in n!.\n\nNote th... |
binary-search-tree-iterator | binary-search-tree-iterator__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\nImplement the BSTIterator class that represents an iterator over the in-or... |
binary-search-tree-iterator | binary-search-tree-iterator__02__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\nImplement the BSTIterator class that represents an iterator over the in-or... |
dungeon-game | dungeon-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\nThe demons had captured the princess and imprisoned her in the bottom-righ... |
largest-number | largest-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\nGiven a list of non-negative integers nums, arrange them such that they fo... |
reverse-words-in-a-string-ii | reverse-words-in-a-string-ii__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 character array s, reverse the order of the words.\n\nA word is de... |
repeated-dna-sequences | repeated-dna-sequences__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 DNA sequence is composed of a series of nucleotides abbreviated as 'A'... |
best-time-to-buy-and-sell-stock-iv | best-time-to-buy-and-sell-stock-iv__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 prices where prices[i] is the price of a gi... |
best-time-to-buy-and-sell-stock-iv | best-time-to-buy-and-sell-stock-iv__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 prices where prices[i] is the price of a gi... |
best-time-to-buy-and-sell-stock-iv | best-time-to-buy-and-sell-stock-iv__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 prices where prices[i] is the price of a gi... |
rotate-array | rotate-array__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 integer array nums, rotate the array to the right by k steps, whe... |
reverse-bits | reverse-bits__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\nReverse bits of a given 32 bits signed integer.\n\n### Examples\nInput: n ... |
number-of-1-bits | number-of-1-bits__01__java | Divide and Conquer | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven a positive integer n, write a function that returns the number of se... |
number-of-1-bits | number-of-1-bits__02__java | Divide and Conquer | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven a positive integer n, write a function that returns the number of se... |
house-robber | house-robber__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 a professional robber planning to rob houses along a street. Each ... |
house-robber | house-robber__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 a professional robber planning to rob houses along a street. Each ... |
house-robber | house-robber__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 a professional robber planning to rob houses along a street. Each ... |
binary-tree-right-side-view | binary-tree-right-side-view__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\nGiven the root of a binary tree, imagine yourself standing on the right si... |
binary-tree-right-side-view | binary-tree-right-side-view__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\nGiven the root of a binary tree, imagine yourself standing on the right si... |
number-of-islands | number-of-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\nGiven an m x n 2D binary grid grid which represents a map of '1's (land) a... |
number-of-islands | number-of-islands__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\nGiven an m x n 2D binary grid grid which represents a map of '1's (land) a... |
number-of-islands | number-of-islands__03__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 m x n 2D binary grid grid which represents a map of '1's (land) a... |
bitwise-and-of-numbers-range | bitwise-and-of-numbers-range__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 that represent the range [left, right], ... |
happy-number | happy-number__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\nWrite an algorithm to determine if a number n is happy.\n\nA happy number ... |
happy-number | happy-number__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\nWrite an algorithm to determine if a number n is happy.\n\nA happy number ... |
remove-linked-list-elements | remove-linked-list-elements__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 the head of a linked list and an integer val, remove all the nodes o... |
count-primes | count-primes__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, return the number of prime numbers that are strictly l... |
isomorphic-strings | isomorphic-strings__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 two strings s and t, determine if they are isomorphic.\n\nTwo string... |
isomorphic-strings | isomorphic-strings__02__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 two strings s and t, determine if they are isomorphic.\n\nTwo string... |
reverse-linked-list | reverse-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 the head of a singly linked list, reverse the list, and return the r... |
reverse-linked-list | reverse-linked-list__02__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\nGiven the head of a singly linked list, reverse the list, and return the r... |
course-schedule | course-schedule__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\nThere are a total of numCourses courses you have to take, labeled from 0 t... |
minimum-size-subarray-sum | minimum-size-subarray-sum__01__java | Binary Search | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven an array of positive integers nums and a positive integer target, re... |
minimum-size-subarray-sum | minimum-size-subarray-sum__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\nGiven an array of positive integers nums and a positive integer target, re... |
course-schedule-ii | course-schedule-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\nThere are a total of numCourses courses you have to take, labeled from 0 t... |
design-add-and-search-words-data-structure | design-add-and-search-words-data-structure__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\nDesign a data structure that supports adding new words and finding if a st... |
word-search-ii | word-search-ii__01__java | Backtracking | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven an m x n board of characters and a list of strings words, return all... |
house-robber-ii | house-robber-ii__01__java | Dynamic Programming | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are a professional robber planning to rob houses along a street. Each ... |
shortest-palindrome | shortest-palindrome__01__java | String | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a string s. You can convert s to a palindrome by adding char... |
shortest-palindrome | shortest-palindrome__02__java | String | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a string s. You can convert s to a palindrome by adding char... |
kth-largest-element-in-an-array | kth-largest-element-in-an-array__01__java | Divide and Conquer | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven an integer array nums and an integer k, return the kth largest eleme... |
kth-largest-element-in-an-array | kth-largest-element-in-an-array__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\nGiven an integer array nums and an integer k, return the kth largest eleme... |
kth-largest-element-in-an-array | kth-largest-element-in-an-array__03__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 and an integer k, return the kth largest eleme... |
combination-sum-iii | combination-sum-iii__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\nFind all valid combinations of k numbers that sum up to n such that the fo... |
combination-sum-iii | combination-sum-iii__02__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\nFind all valid combinations of k numbers that sum up to n such that the fo... |
contains-duplicate | contains-duplicate__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, return true if any value appears at least twi... |
contains-duplicate | contains-duplicate__02__java | Hash Table | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven an integer array nums, return true if any value appears at least twi... |
contains-duplicate-ii | contains-duplicate-ii__01__java | Hash Table | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven an integer array nums and an integer k, return true if there are two... |
contains-duplicate-iii | contains-duplicate-iii__01__java | Sliding Window | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer array nums and two integers indexDiff and valueDi... |
maximal-square | maximal-square__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 an m x n binary matrix filled with 0's and 1's, find the largest squ... |
count-complete-tree-nodes | count-complete-tree-nodes__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\nGiven the root of a complete binary tree, return the number of the nodes i... |
count-complete-tree-nodes | count-complete-tree-nodes__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\nGiven the root of a complete binary tree, return the number of the nodes i... |
rectangle-area | rectangle-area__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 coordinates of two rectilinear rectangles in a 2D plane, return ... |
basic-calculator | basic-calculator__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 string s representing a valid expression, implement a basic calcul... |
implement-stack-using-queues | implement-stack-using-queues__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\nImplement a last-in-first-out (LIFO) stack using only two queues. The impl... |
invert-binary-tree | invert-binary-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\nGiven the root of a binary tree, invert the tree, and return its root.\n\n... |
basic-calculator-ii | basic-calculator-ii__01__java | Math | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nGiven a string s which represents an expression, evaluate this expression ... |
summary-ranges | summary-ranges__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 sorted unique integer array nums.\n\nA range [a,b] is the ... |
majority-element-ii | majority-element-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\nGiven an integer array of size n, find all elements that appear more than ... |
kth-smallest-element-in-a-bst | kth-smallest-element-in-a-bst__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 search tree, and an integer k, return the kth s... |
kth-smallest-element-in-a-bst | kth-smallest-element-in-a-bst__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\nGiven the root of a binary search tree, and an integer k, return the kth s... |
power-of-two | power-of-two__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 an integer n, return true if it is a power of two. Otherwise, return... |
power-of-two | power-of-two__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 an integer n, return true if it is a power of two. Otherwise, return... |
implement-queue-using-stacks | implement-queue-using-stacks__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\nImplement a first in first out (FIFO) queue using only two stacks. The imp... |
number-of-digit-one | number-of-digit-one__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 an integer n, count the total number of digit 1 appearing in all non... |
palindrome-linked-list | palindrome-linked-list__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 the head of a singly linked list, return true if it is a palindrome ... |
lowest-common-ancestor-of-a-binary-search-tree | lowest-common-ancestor-of-a-binary-search-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 binary search tree (BST), find the lowest common ancestor (LCA) no... |
lowest-common-ancestor-of-a-binary-search-tree | lowest-common-ancestor-of-a-binary-search-tree__02__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\nGiven a binary search tree (BST), find the lowest common ancestor (LCA) no... |
lowest-common-ancestor-of-a-binary-tree | lowest-common-ancestor-of-a-binary-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\nGiven a binary tree, find the lowest common ancestor (LCA) of two given no... |
delete-node-in-a-linked-list | delete-node-in-a-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\nThere is a singly-linked list head and we want to delete a node node in it... |
product-of-array-except-self | product-of-array-except-self__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, return an array answer such that answer[i] is... |
sliding-window-maximum | sliding-window-maximum__01__java | Heap | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Java solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an array of integers nums, there is a sliding window of size... |
sliding-window-maximum | sliding-window-maximum__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 array of integers nums, there is a sliding window of size... |
search-a-2d-matrix-ii | search-a-2d-matrix-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\nWrite an efficient algorithm that searches for a value target in an m x n ... |
search-a-2d-matrix-ii | search-a-2d-matrix-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\nWrite an efficient algorithm that searches for a value target in an m x n ... |
different-ways-to-add-parentheses | different-ways-to-add-parentheses__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 expression of numbers and operators, return all possible re... |
valid-anagram | valid-anagram__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 two strings s and t, return true if t is an anagram of s, and false ... |
shortest-word-distance | shortest-word-distance__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 strings wordsDict and two different strings that already... |
shortest-word-distance-ii | shortest-word-distance-ii__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\nDesign a data structure that will be initialized with a string array, and ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.