slug
stringlengths
4
77
solution_id
stringlengths
16
89
primary_algorithm
stringclasses
22 values
verified
bool
1 class
messages
listlengths
3
3
cyclically-rotating-a-grid
cyclically-rotating-a-grid__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an m x n integer matrix grid​​​, where m and n are both ev...
number-of-wonderful-substrings
number-of-wonderful-substrings__01__python
Bit Manipulation
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nA wonderful string is a string where at most one letter appears an odd n...
count-ways-to-build-rooms-in-an-ant-colony
count-ways-to-build-rooms-in-an-ant-colony__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are an ant tasked with adding n new rooms numbered 0 to n-1 to your ...
eliminate-maximum-number-of-monsters
eliminate-maximum-number-of-monsters__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are playing a video game where you are defending your city from a gr...
count-good-numbers
count-good-numbers__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nA digit string is good if the digits (0-indexed) at even indices are eve...
longest-common-subpath
longest-common-subpath__01__python
Binary Search
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nThere is a country of n cities numbered from 0 to n - 1. In this country...
nearest-exit-from-entrance-in-maze
nearest-exit-from-entrance-in-maze__01__python
BFS
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an m x n matrix maze (0-indexed) with empty cells (represe...
minimum-cost-to-reach-destination-in-time
minimum-cost-to-reach-destination-in-time__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nThere is a country of n cities numbered from 0 to n - 1 where all the ci...
concatenation-of-array
concatenation-of-array__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums of length n, you want to create an array ans...
painting-a-grid-with-three-different-colors
painting-a-grid-with-three-different-colors__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given two integers m and n. Consider an m x n grid where each ce...
maximum-number-of-words-you-can-type
maximum-number-of-words-you-can-type__01__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nThere is a malfunctioning keyboard where some letter keys do not work. A...
maximum-number-of-points-with-cost
maximum-number-of-points-with-cost__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an m x n integer matrix points (0-indexed). Starting with ...
longest-common-subsequence-between-sorted-arrays
longest-common-subsequence-between-sorted-arrays__01__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an array of integer arrays arrays where each arrays[i] is sorted i...
check-if-all-characters-have-equal-number-of-occurrences
check-if-all-characters-have-equal-number-of-occurrences__01__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a string s, return true if s is a good string, or false otherwise....
number-of-visible-people-in-a-queue
number-of-visible-people-in-a-queue__01__python
Array
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nThere are n people standing in a queue, and they numbered from 0 to n - ...
sum-of-digits-of-string-after-convert
sum-of-digits-of-string-after-convert__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a string s consisting of lowercase English letters, and an...
largest-number-after-mutating-substring
largest-number-after-mutating-substring__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a string num, which represents a large integer. You are al...
maximum-compatibility-score-sum
maximum-compatibility-score-sum__01__python
Backtracking
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nThere is a survey that consists of n questions where each question's ans...
maximum-of-minimum-values-in-all-subarrays
maximum-of-minimum-values-in-all-subarrays__01__python
Array
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums of size n. You are asked to solve n ...
maximum-number-of-weeks-for-which-you-can-work
maximum-number-of-weeks-for-which-you-can-work__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nThere are n projects numbered from 0 to n - 1. You are given an integer ...
minimum-garden-perimeter-to-collect-enough-apples
minimum-garden-perimeter-to-collect-enough-apples__01__python
Binary Search
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nIn a garden represented as an infinite 2D grid, there is an apple tree p...
minimum-garden-perimeter-to-collect-enough-apples
minimum-garden-perimeter-to-collect-enough-apples__02__python
Binary Search
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nIn a garden represented as an infinite 2D grid, there is an apple tree p...
count-number-of-special-subsequences
count-number-of-special-subsequences__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nA sequence is special if it consists of a positive number of 0s, followe...
count-number-of-special-subsequences
count-number-of-special-subsequences__02__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nA sequence is special if it consists of a positive number of 0s, followe...
delete-characters-to-make-fancy-string
delete-characters-to-make-fancy-string__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nA fancy string is a string where no three consecutive characters are equ...
check-if-move-is-legal
check-if-move-is-legal__01__python
Array
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed 8 x 8 grid board, where board[r][c] represents...
minimum-total-space-wasted-with-k-resizing-operations
minimum-total-space-wasted-with-k-resizing-operations__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are currently designing a dynamic array. You are given a 0-indexed i...
maximum-product-of-the-length-of-two-palindromic-substrings
maximum-product-of-the-length-of-two-palindromic-substrings__01__python
Two Pointers
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed string s and are tasked with finding two non-i...
check-if-string-is-a-prefix-of-array
check-if-string-is-a-prefix-of-array__01__python
Two Pointers
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a string s and an array of strings words, determine whether s is a...
minimum-number-of-swaps-to-make-the-string-balanced
minimum-number-of-swaps-to-make-the-string-balanced__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed string s of even length n. The string consists...
number-of-strings-that-appear-as-substrings-in-word
number-of-strings-that-appear-as-substrings-in-word__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an array of strings patterns and a string word, return the number ...
minimum-non-zero-product-of-the-array-elements
minimum-non-zero-product-of-the-array-elements__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a positive integer p. Consider an array nums (1-indexed) t...
find-if-path-exists-in-graph
find-if-path-exists-in-graph__01__python
DFS
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nThere is a bi-directional graph with n vertices, where each vertex is la...
find-if-path-exists-in-graph
find-if-path-exists-in-graph__02__python
BFS
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nThere is a bi-directional graph with n vertices, where each vertex is la...
find-if-path-exists-in-graph
find-if-path-exists-in-graph__03__python
DFS
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nThere is a bi-directional graph with n vertices, where each vertex is la...
number-of-ways-to-arrive-at-destination
number-of-ways-to-arrive-at-destination__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are in a city that consists of n intersections numbered from 0 to n ...
number-of-ways-to-separate-numbers
number-of-ways-to-separate-numbers__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou wrote down many positive integers in a string called num. However, y...
minimize-the-difference-between-target-and-chosen-elements
minimize-the-difference-between-target-and-chosen-elements__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an m x n integer matrix mat and an integer target.\n\nChoo...
widest-pair-of-indices-with-equal-range-sum
widest-pair-of-indices-with-equal-range-sum__01__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given two 0-indexed binary arrays nums1 and nums2. Find the wide...
minimum-difference-between-highest-and-lowest-of-k-scores
minimum-difference-between-highest-and-lowest-of-k-scores__01__python
Sliding Window
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array nums, where nums[i] represents t...
minimum-number-of-work-sessions-to-finish-the-tasks
minimum-number-of-work-sessions-to-finish-the-tasks__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nThere are n tasks assigned to you. The task times are represented as an ...
number-of-unique-good-subsequences
number-of-unique-good-subsequences__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a binary string binary. A subsequence of binary is conside...
find-the-middle-index-in-array
find-the-middle-index-in-array__01__python
Array
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a 0-indexed integer array nums, find the leftmost middleIndex (i.e...
find-all-groups-of-farmland
find-all-groups-of-farmland__01__python
DFS
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed m x n binary matrix land where a 0 represents ...
the-number-of-good-subsets
the-number-of-good-subsets__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums. We call a subset of nums good if it...
count-special-quadruplets
count-special-quadruplets__01__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a 0-indexed integer array nums, return the number of distinct quad...
count-special-quadruplets
count-special-quadruplets__02__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a 0-indexed integer array nums, return the number of distinct quad...
count-special-quadruplets
count-special-quadruplets__03__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a 0-indexed integer array nums, return the number of distinct quad...
the-number-of-weak-characters-in-the-game
the-number-of-weak-characters-in-the-game__01__python
Sorting
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are playing a game that contains multiple characters, and each of th...
first-day-where-you-have-been-in-all-the-rooms
first-day-where-you-have-been-in-all-the-rooms__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nThere are n rooms you need to visit, labeled from 0 to n - 1. Each day i...
reverse-prefix-of-word
reverse-prefix-of-word__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a 0-indexed string word and a character ch, reverse the segment of...
smallest-missing-genetic-value-in-each-subtree
smallest-missing-genetic-value-in-each-subtree__01__python
DFS
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nThere is a family tree rooted at 0 consisting of n nodes numbered 0 to n...
find-original-array-from-doubled-array
find-original-array-from-doubled-array__01__python
Sorting
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nAn integer array original is transformed into a doubled array changed by...
minimum-number-of-operations-to-make-array-continuous
minimum-number-of-operations-to-make-array-continuous__02__python
Two Pointers
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums. In one operation, you can replace a...
sum-of-beauty-in-the-array
sum-of-beauty-in-the-array__01__python
Array
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array nums. For each index i (1 <= i <...
average-height-of-buildings-in-each-segment
average-height-of-buildings-in-each-segment__01__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nA perfectly straight street is represented by a number line. The street ...
maximum-difference-between-increasing-elements
maximum-difference-between-increasing-elements__01__python
Array
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a 0-indexed integer array nums of size n, find the maximum differe...
check-if-word-can-be-placed-in-crossword
check-if-word-can-be-placed-in-crossword__01__python
Array
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an m x n matrix board, representing the current state of a...
the-score-of-students-solving-math-expression
the-score-of-students-solving-math-expression__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a string s that contains digits 0-9, addition symbols '+',...
brightest-position-on-street
brightest-position-on-street__01__python
Sorting
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nA perfectly straight street is represented by a number line. The street ...
convert-1d-array-into-2d-array
convert-1d-array-into-2d-array__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed 1-dimensional (1D) integer array original, and...
number-of-pairs-of-strings-with-concatenation-equal-to-target
number-of-pairs-of-strings-with-concatenation-equal-to-target__01__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an array of digit strings nums and a digit string target, return t...
number-of-pairs-of-strings-with-concatenation-equal-to-target
number-of-pairs-of-strings-with-concatenation-equal-to-target__02__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an array of digit strings nums and a digit string target, return t...
maximize-the-confusion-of-an-exam
maximize-the-confusion-of-an-exam__01__python
Sliding Window
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nA teacher is writing a test with n true/false questions, with 'T' denoti...
maximum-number-of-ways-to-partition-an-array
maximum-number-of-ways-to-partition-an-array__01__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array nums of length n. The number of ...
minimum-moves-to-convert-string
minimum-moves-to-convert-string__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a string s consisting of n characters which are either 'X'...
stone-game-ix
stone-game-ix__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nAlice and Bob continue their games with stones. There is a row of n ston...
count-subarrays-with-more-ones-than-zeros
count-subarrays-with-more-ones-than-zeros__01__python
Binary Search
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a binary array nums containing only the integers 0 and 1. ...
minimum-operations-to-make-a-uni-value-grid
minimum-operations-to-make-a-uni-value-grid__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 2D integer grid of size m x n and an integer x. In one o...
partition-array-into-two-arrays-to-minimize-sum-difference
partition-array-into-two-arrays-to-minimize-sum-difference__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given an integer array nums of 2 * n integers. You need to parti...
maximum-alternating-subarray-sum
maximum-alternating-subarray-sum__01__python
Dynamic Programming
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nA subarray of a 0-indexed integer array is a contiguous non-empty sequen...
minimum-number-of-moves-to-seat-everyone
minimum-number-of-moves-to-seat-everyone__01__python
Sorting
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nThere are n availabe seats and n students standing in a room. You are gi...
the-time-when-the-network-becomes-idle
the-time-when-the-network-becomes-idle__01__python
BFS
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nThere is a network of n servers, labeled from 0 to n - 1. You are given ...
check-if-numbers-are-ascending-in-a-sentence
check-if-numbers-are-ascending-in-a-sentence__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nA sentence is a list of tokens separated by a single space with no leadi...
count-number-of-maximum-bitwise-or-subsets
count-number-of-maximum-bitwise-or-subsets__02__python
Backtracking
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven an integer array nums, find the maximum possible bitwise OR of a s...
second-minimum-time-to-reach-destination
second-minimum-time-to-reach-destination__01__python
BFS
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nA city is represented as a bi-directional connected graph with n vertice...
sort-linked-list-already-sorted-using-absolute-values
sort-linked-list-already-sorted-using-absolute-values__01__python
Two Pointers
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven the head of a singly linked list that is sorted in non-decreasing ...
number-of-valid-words-in-a-sentence
number-of-valid-words-in-a-sentence__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nA sentence consists of lowercase letters ('a' to 'z'), digits ('0' to '9...
count-nodes-with-the-highest-score
count-nodes-with-the-highest-score__01__python
DFS
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nThere is a binary tree rooted at 0 consisting of n nodes. The nodes are ...
kth-distinct-string-in-an-array
kth-distinct-string-in-an-array__01__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nA distinct string is a string that is present only once in an array.\n\n...
plates-between-candles
plates-between-candles__01__python
Binary Search
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nThere is a long table with a line of plates and candles arranged on top ...
smallest-index-with-equal-value
smallest-index-with-equal-value__01__python
Array
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a 0-indexed integer array nums, return the smallest index i of num...
find-the-minimum-and-maximum-number-of-nodes-between-critical-points
find-the-minimum-and-maximum-number-of-nodes-between-critical-points__01__python
Linked List
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nA critical point in a linked list is defined as either a local maxima or...
minimum-operations-to-convert-number
minimum-operations-to-convert-number__01__python
BFS
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array nums containing distinct numbers...
minimum-operations-to-convert-number
minimum-operations-to-convert-number__02__python
BFS
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array nums containing distinct numbers...
minimum-operations-to-convert-number
minimum-operations-to-convert-number__03__python
BFS
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed integer array nums containing distinct numbers...
count-vowel-substrings-of-a-string
count-vowel-substrings-of-a-string__01__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nA substring is a contiguous (non-empty) sequence of characters within a ...
vowels-of-all-substrings
vowels-of-all-substrings__01__python
Brute Force
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven a string word, return the sum of the number of vowels ('a', 'e', '...
maximum-path-quality-of-a-graph
maximum-path-quality-of-a-graph__01__python
DFS
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nThere is an undirected graph with n nodes numbered from 0 to n - 1 (incl...
number-of-equal-count-substrings
number-of-equal-count-substrings__01__python
Sliding Window
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed string s consisting of only lowercase English ...
check-whether-two-strings-are-almost-equivalent
check-whether-two-strings-are-almost-equivalent__01__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nTwo strings word1 and word2 are considered almost equivalent if the diff...
most-beautiful-item-for-each-query
most-beautiful-item-for-each-query__01__python
Sorting
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 2D integer array items where items[i] = [pricei, beautyi...
maximum-number-of-tasks-you-can-assign
maximum-number-of-tasks-you-can-assign__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou have n tasks and m workers. Each task has a strength requirement sto...
time-needed-to-buy-tickets
time-needed-to-buy-tickets__01__python
Array
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nThere are n people in a line queuing to buy tickets, where the 0th perso...
reverse-nodes-in-even-length-groups
reverse-nodes-in-even-length-groups__01__python
Linked List
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given the head of a linked list.\n\nThe nodes in the linked list...
decode-the-slanted-ciphertext
decode-the-slanted-ciphertext__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nA string originalText is encoded using a slanted transposition cipher to...
two-furthest-houses-with-different-colors
two-furthest-houses-with-different-colors__01__python
Greedy
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nThere are n houses evenly lined up on the street, and each house is beau...
watering-plants
watering-plants__01__python
Math
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou want to water n plants in your garden with a watering can. The plant...
substrings-that-begin-and-end-with-the-same-letter
substrings-that-begin-and-end-with-the-same-letter__01__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nYou are given a 0-indexed string s consisting of only lowercase English ...
count-common-words-with-one-occurrence
count-common-words-with-one-occurrence__01__python
Hash Table
true
[ { "role": "system", "content": "You are a competitive programming assistant. Given a problem, its examples, and a required algorithm/technique, write a correct Python solution." }, { "role": "user", "content": "### Problem\nGiven two string arrays words1 and words2, return the number of strings ...