slug stringlengths 4 75 | solution_id stringlengths 20 91 | primary_algorithm stringclasses 22
values | verified null | messages listlengths 3 3 |
|---|---|---|---|---|
combination-sum-iv | combination-sum-iv__01__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven an array of distinct integers nums and a target integer target... |
shuffle-an-array | shuffle-an-array__01__javascript | Math | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven an integer array nums, design an algorithm to randomly shuffle... |
lexicographical-numbers | lexicographical-numbers__01__javascript | DFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven an integer n, return all the numbers in the range [1, n] sorte... |
first-unique-character-in-a-string | first-unique-character-in-a-string__01__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven a string s, find the first non-repeating character in it and r... |
nth-digit | nth-digit__01__javascript | Math | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven an integer n, return the nth digit of the infinite integer seq... |
split-array-largest-sum | split-array-largest-sum__01__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven an integer array nums and an integer k, split nums into k non-... |
fizz-buzz | fizz-buzz__01__javascript | Math | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven an integer n, return a string array answer (1-indexed) where:\... |
add-strings | add-strings__01__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven two non-negative integers, num1 and num2 represented as string... |
partition-equal-subset-sum | partition-equal-subset-sum__01__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven an integer array nums, return true if you can partition the ar... |
partition-equal-subset-sum | partition-equal-subset-sum__02__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven an integer array nums, return true if you can partition the ar... |
convert-binary-search-tree-to-sorted-doubly-linked-list | convert-binary-search-tree-to-sorted-doubly-linked-list__01__javascript | DFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nConvert a Binary Search Tree to a sorted Circular Doubly-Linked List... |
path-sum-iii | path-sum-iii__01__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven the root of a binary tree and an integer targetSum, return the... |
assign-cookies | assign-cookies__01__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nAssume you are an awesome parent and want to give your children some... |
hamming-distance | hamming-distance__01__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nThe Hamming distance between two integers is the number of positions... |
number-complement | number-complement__01__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nThe complement of an integer is the integer you get when you flip al... |
number-complement | number-complement__02__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nThe complement of an integer is the integer you get when you flip al... |
max-consecutive-ones | max-consecutive-ones__01__javascript | Array | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven a binary array nums, return the maximum number of consecutive ... |
max-consecutive-ones-ii | max-consecutive-ones-ii__01__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven a binary array nums, return the maximum number of consecutive ... |
target-sum | target-sum__01__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer array nums and an integer target.\n\nYou wa... |
target-sum | target-sum__02__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer array nums and an integer target.\n\nYou wa... |
next-greater-element-i | next-greater-element-i__01__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nThe next greater element of some element x in an array is the first ... |
next-greater-element-ii | next-greater-element-ii__01__javascript | Array | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven a circular integer array nums (i.e., the next element of nums[... |
fibonacci-number | fibonacci-number__01__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nThe Fibonacci numbers, commonly denoted F(n) form a sequence, called... |
fibonacci-number | fibonacci-number__02__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nThe Fibonacci numbers, commonly denoted F(n) form a sequence, called... |
inorder-successor-in-bst-ii | inorder-successor-in-bst-ii__01__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven a node in a binary search tree, return the in-order successor ... |
contiguous-array | contiguous-array__01__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven a binary array nums, return the maximum length of a contiguous... |
random-pick-with-weight | random-pick-with-weight__01__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a 0-indexed array of positive integers w where w[i] de... |
minimum-absolute-difference-in-bst | minimum-absolute-difference-in-bst__01__javascript | DFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven the root of a Binary Search Tree (BST), return the minimum abs... |
convert-bst-to-greater-tree | convert-bst-to-greater-tree__01__javascript | DFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven the root of a Binary Search Tree (BST), convert it to a Greate... |
diameter-of-binary-tree | diameter-of-binary-tree__01__javascript | DFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven the root of a binary tree, return the length of the diameter o... |
boundary-of-binary-tree | boundary-of-binary-tree__01__javascript | DFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nThe boundary of a binary tree is the concatenation of the root, the ... |
brick-wall | brick-wall__01__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nThere is a rectangular brick wall in front of you with n rows of bri... |
reverse-words-in-a-string-iii | reverse-words-in-a-string-iii__01__javascript | Math | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven a string s, reverse the order of characters in each word withi... |
array-partition | array-partition__01__javascript | Sorting | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven an integer array nums of 2n integers, group these integers int... |
find-the-closest-palindrome | find-the-closest-palindrome__01__javascript | Math | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven a string n representing an integer, return the closest integer... |
subtree-of-another-tree | subtree-of-another-tree__01__javascript | DFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven the roots of two binary trees root and subRoot, return true if... |
fraction-addition-and-subtraction | fraction-addition-and-subtraction__01__javascript | Math | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven a string expression representing an expression of fraction add... |
range-addition-ii | range-addition-ii__01__javascript | Math | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an m x n matrix M initialized with all 0's and an arra... |
merge-two-binary-trees | merge-two-binary-trees__01__javascript | DFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nYou are given two binary trees root1 and root2.\n\nImagine that when... |
maximum-distance-in-arrays | maximum-distance-in-arrays__01__javascript | Greedy | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nYou are given m arrays, where each array is sorted in ascending orde... |
smallest-range-covering-elements-from-k-lists | smallest-range-covering-elements-from-k-lists__02__javascript | Heap | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nYou have k lists of sorted integers in non-decreasing order. Find th... |
average-of-levels-in-binary-tree | average-of-levels-in-binary-tree__01__javascript | BFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven the root of a binary tree, return the average value of the nod... |
average-of-levels-in-binary-tree | average-of-levels-in-binary-tree__02__javascript | DFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven the root of a binary tree, return the average value of the nod... |
palindromic-substrings | palindromic-substrings__01__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven a string s, return the number of palindromic substrings in it.... |
2-keys-keyboard | 2-keys-keyboard__02__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nThere is only one character 'A' on the screen of a notepad. You can ... |
robot-return-to-origin | robot-return-to-origin__01__javascript | String | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nThere is a robot starting at the position (0, 0), the origin, on a 2... |
trim-a-binary-search-tree | trim-a-binary-search-tree__01__javascript | DFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven the root of a binary search tree and the lowest and highest bo... |
trim-a-binary-search-tree | trim-a-binary-search-tree__02__javascript | DFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven the root of a binary search tree and the lowest and highest bo... |
maximum-swap | maximum-swap__02__javascript | Greedy | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer num. You can swap two digits at most once t... |
second-minimum-node-in-a-binary-tree | second-minimum-node-in-a-binary-tree__01__javascript | DFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven a non-empty special binary tree consisting of nodes with the n... |
map-sum-pairs | map-sum-pairs__01__javascript | Trie | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nDesign a map that allows you to do the following:\n\n\tMaps a string... |
valid-palindrome-ii | valid-palindrome-ii__01__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven a string s, return true if the s can be palindrome after delet... |
redundant-connection | redundant-connection__01__javascript | DFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nIn this problem, a tree is an undirected graph that is connected and... |
redundant-connection | redundant-connection__02__javascript | DFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nIn this problem, a tree is an undirected graph that is connected and... |
redundant-connection-ii | redundant-connection-ii__01__javascript | DFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nIn this problem, a rooted tree is a directed graph such that, there ... |
redundant-connection-ii | redundant-connection-ii__02__javascript | DFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nIn this problem, a rooted tree is a directed graph such that, there ... |
longest-univalue-path | longest-univalue-path__01__javascript | DFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven the root of a binary tree, return the length of the longest pa... |
employee-importance | employee-importance__01__javascript | DFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nYou have a data structure of employee information, including the emp... |
kth-largest-element-in-a-stream | kth-largest-element-in-a-stream__01__javascript | Heap | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nYou are part of a university admissions office and need to keep trac... |
binary-search | binary-search__01__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven an array of integers nums which is sorted in ascending order, ... |
minimum-ascii-delete-sum-for-two-strings | minimum-ascii-delete-sum-for-two-strings__01__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven two strings s1 and s2, return the lowest ASCII sum of deleted ... |
subarray-product-less-than-k | subarray-product-less-than-k__01__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven an array of integers nums and an integer k, return the number ... |
1-bit-and-2-bit-characters | 1-bit-and-2-bit-characters__01__javascript | Array | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nWe have two special characters:\n\n\tThe first character can be repr... |
maximum-length-of-repeated-subarray | maximum-length-of-repeated-subarray__01__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven two integer arrays nums1 and nums2, return the maximum length ... |
find-k-th-smallest-pair-distance | find-k-th-smallest-pair-distance__01__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nThe distance of a pair of integers a and b is defined as the absolut... |
longest-word-in-dictionary | longest-word-in-dictionary__01__javascript | Trie | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven an array of strings words representing an English Dictionary, ... |
find-pivot-index | find-pivot-index__01__javascript | Array | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven an array of integers nums, calculate the pivot index of this a... |
number-of-atoms | number-of-atoms__01__javascript | Sorting | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven a string formula representing a chemical formula, return the c... |
my-calendar-i | my-calendar-i__01__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nYou are implementing a program to use as your calendar. We can add a... |
my-calendar-ii | my-calendar-ii__01__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nYou are implementing a program to use as your calendar. We can add a... |
my-calendar-ii | my-calendar-ii__02__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nYou are implementing a program to use as your calendar. We can add a... |
sentence-similarity | sentence-similarity__01__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nWe can represent a sentence as an array of words, for example, the s... |
daily-temperatures | daily-temperatures__01__javascript | Array | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven an array of integers temperatures represents the daily tempera... |
cherry-pickup | cherry-pickup__01__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an n x n grid representing a field of cherries, each c... |
min-cost-climbing-stairs | min-cost-climbing-stairs__01__javascript | Memoization | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer array cost where cost[i] is the cost of ith... |
min-cost-climbing-stairs | min-cost-climbing-stairs__02__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer array cost where cost[i] is the cost of ith... |
min-cost-climbing-stairs | min-cost-climbing-stairs__03__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer array cost where cost[i] is the cost of ith... |
largest-number-at-least-twice-of-others | largest-number-at-least-twice-of-others__01__javascript | Sorting | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer array nums where the largest integer is uni... |
reach-a-number | reach-a-number__01__javascript | Math | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nYou are standing at position 0 on an infinite number line. There is ... |
partition-labels | partition-labels__01__javascript | Greedy | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nYou are given a string s. We want to partition the string into as ma... |
toeplitz-matrix | toeplitz-matrix__01__javascript | Array | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven an m x n matrix, return true if the matrix is Toeplitz. Otherw... |
max-chunks-to-make-sorted | max-chunks-to-make-sorted__02__javascript | Greedy | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer array arr of length n that represents a per... |
jewels-and-stones | jewels-and-stones__01__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nYou're given strings jewels representing the types of stones that ar... |
split-bst | split-bst__01__javascript | Recursion | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven the root of a binary search tree (BST) and an integer target, ... |
rabbits-in-forest | rabbits-in-forest__02__javascript | Greedy | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nThere is a forest with an unknown number of rabbits. We asked n rabb... |
minimum-distance-between-bst-nodes | minimum-distance-between-bst-nodes__01__javascript | DFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven the root of a Binary Search Tree (BST), return the minimum dif... |
valid-tic-tac-toe-state | valid-tic-tac-toe-state__01__javascript | Array | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven a Tic-Tac-Toe board as a string array board, return true if an... |
all-paths-from-source-to-target | all-paths-from-source-to-target__01__javascript | Backtracking | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven a directed acyclic graph (DAG) of n nodes labeled from 0 to n ... |
find-eventual-safe-states | find-eventual-safe-states__01__javascript | DFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nThere is a directed graph of n nodes with each node labeled from 0 t... |
find-eventual-safe-states | find-eventual-safe-states__02__javascript | DFS | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nThere is a directed graph of n nodes with each node labeled from 0 t... |
binary-tree-pruning | binary-tree-pruning__01__javascript | Recursion | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven the root of a binary tree, return the same tree where every su... |
linked-list-components | linked-list-components__01__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nYou are given the head of a linked list containing unique integer va... |
flipping-an-image | flipping-an-image__01__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven an n x n binary matrix image, flip the image horizontally, the... |
magic-squares-in-grid | magic-squares-in-grid__01__javascript | Math | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nA 3 x 3 magic square is a 3 x 3 grid filled with distinct numbers fr... |
peak-index-in-a-mountain-array | peak-index-in-a-mountain-array__01__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nYou are given an integer mountain array arr of length n where the va... |
lemonade-change | lemonade-change__01__javascript | Greedy | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nAt a lemonade stand, each lemonade costs $5. Customers are standing ... |
lemonade-change | lemonade-change__02__javascript | Greedy | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nAt a lemonade stand, each lemonade costs $5. Customers are standing ... |
shortest-subarray-with-sum-at-least-k | shortest-subarray-with-sum-at-least-k__01__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven an integer array nums and an integer k, return the length of t... |
transpose-matrix | transpose-matrix__01__javascript | Math | null | [
{
"role": "system",
"content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven a 2D integer array matrix, return the transpose of matrix.\n\n... |
binary-gap | binary-gap__01__javascript | 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 JavaScript solution."
},
{
"role": "user",
"content": "### Problem\nGiven a positive integer n, find and return the longest distance bet... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.