prompt listlengths 1 1 | query stringlengths 578 3.33k | constraints listlengths 10 10 | data_source stringclasses 1
value | extra_info dict |
|---|---|---|---|---|
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given two non-empty linked lists representing two non-negative int... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order... | [
"assert is_same_list(candidate(l1=list_node([1, 0, 0, 0, 0]), l2=list_node([9, 9, 9, 9, 9])), list_node([0, 0, 0, 0, 0, 1]))",
"assert is_same_list(candidate(l1=list_node([6, 4, 5]), l2=list_node([0, 4, 5])), list_node([6, 8, 0, 1]))",
"assert is_same_list(candidate(l1=list_node([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0... | newfacade/LeetCodeDataset | {
"constraints": [
"assert is_same_list(candidate(l1=list_node([1, 0, 0, 0, 0]), l2=list_node([9, 9, 9, 9, 9])), list_node([0, 0, 0, 0, 0, 1]))",
"assert is_same_list(candidate(l1=list_node([6, 4, 5]), l2=list_node([0, 4, 5])), list_node([6, 8, 0, 1]))",
"assert is_same_list(candidate(l1=list_node([1, 0, ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven a string s, find the length of the longest substring without repeati... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given a string s, find the length of the longest substring without repeating characters.
Constraints:
0 <= s.length ... | [
"assert candidate(s='abba') == 2",
"assert candidate(s='zyxwvutsrqponmlkjihgfedcba') == 26",
"assert candidate(s='aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz1234567890abcdefghijklmnopqrstuvwxyz') == 36",
"assert candidate(s='rjqzupkoz') == 8",
"assert candidate(s='dvdf') == 3",
"assert candidate(... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='abba') == 2",
"assert candidate(s='zyxwvutsrqponmlkjihgfedcba') == 26",
"assert candidate(s='aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz1234567890abcdefghijklmnopqrstuvwxyz') == 36",
"assert candidate(s='rjqzupkoz') == 8",
"assert candidate(s='dvdf'... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven two sorted arrays nums1 and nums2 of size m and n respectively, retu... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays.
The o... | [
"assert candidate(nums1=[1, 2], nums2=[3, 4]) == 2.5",
"assert candidate(nums1=[1000000], nums2=[999999]) == 999999.5",
"assert candidate(nums1=[1, 3, 5, 7, 9], nums2=[2, 4, 6, 8, 10, 12, 14]) == 6.5",
"assert candidate(nums1=[-5, -3, 0, 8], nums2=[-10, -4, 2, 6, 12]) == 0.0",
"assert candidate(nums1=[1, 2,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums1=[1, 2], nums2=[3, 4]) == 2.5",
"assert candidate(nums1=[1000000], nums2=[999999]) == 999999.5",
"assert candidate(nums1=[1, 3, 5, 7, 9], nums2=[2, 4, 6, 8, 10, 12, 14]) == 6.5",
"assert candidate(nums1=[-5, -3, 0, 8], nums2=[-10, -4, 2, 6, 12]) == 0.0",
"... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven a string s, return the longest palindromic substring in s.\n \nConst... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given a string s, return the longest palindromic substring in s.
Constraints:
1 <= s.length <= 1000
s consist of onl... | [
"assert candidate(s='abcdedcbaefghihgfexyzzyx') == 'efghihgfe'",
"assert candidate(s='abcdeedcbafedcbe') == 'abcdeedcba'",
"assert candidate(s='a') == 'a'",
"assert candidate(s='levelracecardeifiedracecar') == 'racecardeifiedracecar'",
"assert candidate(s='anana') == 'anana'",
"assert candidate(s='aabb') ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='abcdedcbaefghihgfexyzzyx') == 'efghihgfe'",
"assert candidate(s='abcdeedcbafedcbe') == 'abcdeedcba'",
"assert candidate(s='a') == 'a'",
"assert candidate(s='levelracecardeifiedracecar') == 'racecardeifiedracecar'",
"assert candidate(s='anana') == 'anana'",
... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nThe string \"PAYPALISHIRING\" is written in a zigzag pattern on a given nu... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to displa... | [
"assert candidate(s='MULTIPLELINESAREHERE.FIXEDFONTISNEAT.', numRows=15) == 'MNUOTLFITDSIENPXELIAEFTL..IENREESHAER'",
"assert candidate(s='A.B.C.D.E.F.G.H.I.J.K.L.M.N.O.P.Q.R.S.T.U.V.W.X.Y.Z.', numRows=5) == 'AEIMQUY.............BDFHJLNPRTVXZ.............CGKOSW'",
"assert candidate(s='HELLOWORLDTHISISATEST', nu... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='MULTIPLELINESAREHERE.FIXEDFONTISNEAT.', numRows=15) == 'MNUOTLFITDSIENPXELIAEFTL..IENREESHAER'",
"assert candidate(s='A.B.C.D.E.F.G.H.I.J.K.L.M.N.O.P.Q.R.S.T.U.V.W.X.Y.Z.', numRows=5) == 'AEIMQUY.............BDFHJLNPRTVXZ.............CGKOSW'",
"assert candidate(s='H... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nImplement the myAtoi(string s) function, which converts a string to a 32-b... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Implement the myAtoi(string s) function, which converts a string to a 32-bit signed integer.
The algorithm for myAtoi(s... | [
"assert candidate(s=' 0000+123') == 0",
"assert candidate(s=' 2147483648') == 2147483647",
"assert candidate(s='42') == 42",
"assert candidate(s=' -214748364800000000') == -2147483648",
"assert candidate(s=' 21474836470000000000000000000000000') == 2147483647",
"assert candidate(s=' -21474836... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s=' 0000+123') == 0",
"assert candidate(s=' 2147483648') == 2147483647",
"assert candidate(s='42') == 42",
"assert candidate(s=' -214748364800000000') == -2147483648",
"assert candidate(s=' 21474836470000000000000000000000000') == 2147483647",
"a... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an input string s and a pattern p, implement regular expression matc... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given an input string s and a pattern p, implement regular expression matching with support for '.' and '*' where:
'.'... | [
"assert candidate(s='xyxxyxyx', p='(xy)*x') == False",
"assert candidate(s='abcdabcd', p='abcd*') == False",
"assert candidate(s='abcd', p='a*b.c*d*') == True",
"assert candidate(s='abcde', p='a*b*c*d*e*') == True",
"assert candidate(s='abab', p='(ab)*') == False",
"assert candidate(s='mississippi', p='mi... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='xyxxyxyx', p='(xy)*x') == False",
"assert candidate(s='abcdabcd', p='abcd*') == False",
"assert candidate(s='abcd', p='a*b.c*d*') == True",
"assert candidate(s='abcde', p='a*b*c*d*e*') == True",
"assert candidate(s='abab', p='(ab)*') == False",
"assert c... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an integer array height of length n. There are n vertical li... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an integer array height of length n. There are n vertical lines drawn such that the two endpoints of the ... | [
"assert candidate(height=[8, 10, 14, 0, 13, 10, 9, 9, 8, 9]) == 72",
"assert candidate(height=[1, 10, 2, 9, 3, 8, 4, 7, 5, 6, 6, 5, 7, 4, 8, 3, 9, 2, 10, 1]) == 170",
"assert candidate(height=[1, 3, 5, 7, 9, 11, 13, 15, 13, 11, 9, 7, 5, 3, 1]) == 56",
"assert candidate(height=[10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(height=[8, 10, 14, 0, 13, 10, 9, 9, 8, 9]) == 72",
"assert candidate(height=[1, 10, 2, 9, 3, 8, 4, 7, 5, 6, 6, 5, 7, 4, 8, 3, 9, 2, 10, 1]) == 170",
"assert candidate(height=[1, 3, 5, 7, 9, 11, 13, 15, 13, 11, 9, 7, 5, 3, 1]) == 56",
"assert candidate(height=[10, 1... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nSeven different symbols represent Roman numerals with the following values... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Seven different symbols represent Roman numerals with the following values:
Symbol
Value
I
1
V
5
X
10
L
50
C
100
... | [
"assert candidate(num=39) == 'XXXIX'",
"assert candidate(num=1453) == 'MCDLIII'",
"assert candidate(num=2763) == 'MMDCCLXIII'",
"assert candidate(num=583) == 'DLXXXIII'",
"assert candidate(num=1009) == 'MIX'",
"assert candidate(num=1994) == 'MCMXCIV'",
"assert candidate(num=944) == 'CMXLIV'",
"assert ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(num=39) == 'XXXIX'",
"assert candidate(num=1453) == 'MCDLIII'",
"assert candidate(num=2763) == 'MMDCCLXIII'",
"assert candidate(num=583) == 'DLXXXIII'",
"assert candidate(num=1009) == 'MIX'",
"assert candidate(num=1994) == 'MCMXCIV'",
"assert candidate(... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven a string containing digits from 2-9 inclusive, return all possible l... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could repr... | [
"assert candidate(digits='29') == ['aw', 'ax', 'ay', 'az', 'bw', 'bx', 'by', 'bz', 'cw', 'cx', 'cy', 'cz']",
"assert candidate(digits='97531') == ['wpjdw', 'wpjdx', 'wpjdy', 'wpjdz', 'wpjew', 'wpjex', 'wpjey', 'wpjez', 'wpjfw', 'wpjfx', 'wpjfy', 'wpjfz', 'wpkdw', 'wpkdx', 'wpkdy', 'wpkdz', 'wpkew', 'wpkex', 'wpke... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(digits='29') == ['aw', 'ax', 'ay', 'az', 'bw', 'bx', 'by', 'bz', 'cw', 'cx', 'cy', 'cz']",
"assert candidate(digits='97531') == ['wpjdw', 'wpjdx', 'wpjdy', 'wpjdz', 'wpjew', 'wpjex', 'wpjey', 'wpjez', 'wpjfw', 'wpjfx', 'wpjfy', 'wpjfz', 'wpkdw', 'wpkdx', 'wpkdy', 'wpkdz', ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an array nums of n integers, return an array of all the unique quadr... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given an array nums of n integers, return an array of all the unique quadruplets [nums[a], nums[b], nums[c], nums[d]] s... | [
"assert candidate(nums=[-3, -2, -1, 0, 0, 1, 2, 3], target=0) == [[-3, -2, 2, 3], [-3, -1, 1, 3], [-3, 0, 0, 3], [-3, 0, 1, 2], [-2, -1, 0, 3], [-2, -1, 1, 2], [-2, 0, 0, 2], [-1, 0, 0, 1]]",
"assert candidate(nums=[1, -2, -5, -4, -3, 3, 3, 5], target=-11) == [[-5, -4, -3, 1]]",
"assert candidate(nums=[2, 0, 0,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[-3, -2, -1, 0, 0, 1, 2, 3], target=0) == [[-3, -2, 2, 3], [-3, -1, 1, 3], [-3, 0, 0, 3], [-3, 0, 1, 2], [-2, -1, 0, 3], [-2, -1, 1, 2], [-2, 0, 0, 2], [-1, 0, 0, 1]]",
"assert candidate(nums=[1, -2, -5, -4, -3, 3, 3, 5], target=-11) == [[-5, -4, -3, 1]]",
"assert... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven the head of a linked list, remove the nth node from the end of the l... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given the head of a linked list, remove the nth node from the end of the list and return its head.
Constraints:
The ... | [
"assert is_same_list(candidate(head=list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), n=4), list_node([1, 2, 3, 4, 5, 6, 8, 9, 10]))",
"assert is_same_list(candidate(head=list_node([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]), n=1), list_node([0, 1, 2, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert is_same_list(candidate(head=list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), n=4), list_node([1, 2, 3, 4, 5, 6, 8, 9, 10]))",
"assert is_same_list(candidate(head=list_node([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]), n=1... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven a linked list, swap every two adjacent nodes and return its head. Yo... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given a linked list, swap every two adjacent nodes and return its head. You must solve the problem without modifying th... | [
"assert is_same_list(candidate(head=list_node([1, 2, 3, 4, 5, 6, 7, 8, 9])), list_node([2, 1, 4, 3, 6, 5, 8, 7, 9]))",
"assert is_same_list(candidate(head=list_node([1, 2, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11])), list_node([2, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11... | newfacade/LeetCodeDataset | {
"constraints": [
"assert is_same_list(candidate(head=list_node([1, 2, 3, 4, 5, 6, 7, 8, 9])), list_node([2, 1, 4, 3, 6, 5, 8, 7, 9]))",
"assert is_same_list(candidate(head=list_node([1, 2, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11])), list_node([2, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7,... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven the head of a linked list, reverse the nodes of the list k at a time... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given the head of a linked list, reverse the nodes of the list k at a time, and return the modified list.
k is a positi... | [
"assert is_same_list(candidate(head=list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]), k=6), list_node([6, 5, 4, 3, 2, 1, 12, 11, 10, 9, 8, 7, 13, 14, 15, 16, 17]))",
"assert is_same_list(candidate(head=list_node([1, 2, 3, 4]), k=4), list_node([4, 3, 2, 1]))",
"assert is_same_list(candidate... | newfacade/LeetCodeDataset | {
"constraints": [
"assert is_same_list(candidate(head=list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]), k=6), list_node([6, 5, 4, 3, 2, 1, 12, 11, 10, 9, 8, 7, 13, 14, 15, 16, 17]))",
"assert is_same_list(candidate(head=list_node([1, 2, 3, 4]), k=4), list_node([4, 3, 2, 1]))",
"asse... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven two integers dividend and divisor, divide two integers without using... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given two integers dividend and divisor, divide two integers without using multiplication, division, and mod operator.
... | [
"assert candidate(dividend=100, divisor=5) == 20",
"assert candidate(dividend=-15, divisor=4) == -3",
"assert candidate(dividend=-1000000000, divisor=25) == -40000000",
"assert candidate(dividend=15, divisor=-3) == -5",
"assert candidate(dividend=-1, divisor=-1) == 1",
"assert candidate(dividend=-1025, di... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(dividend=100, divisor=5) == 20",
"assert candidate(dividend=-15, divisor=4) == -3",
"assert candidate(dividend=-1000000000, divisor=25) == -40000000",
"assert candidate(dividend=15, divisor=-3) == -5",
"assert candidate(dividend=-1, divisor=-1) == 1",
"asse... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given a string s and an array of strings words. All the strings of... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given a string s and an array of strings words. All the strings of words are of the same length.
A concatenated... | [
"assert candidate(s='repeatedrepeatedrepeated', words=['repeated', 'repe', 'atedre', 'peated']) == []",
"assert candidate(s='xyzxyzxyzxyz', words=['xyz', 'xyz', 'xyz', 'xyz']) == [0]",
"assert candidate(s='barfoothefoobarman', words=['foo', 'bar']) == [0, 9]",
"assert candidate(s='abcdefgabcdefgabcdefg', word... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='repeatedrepeatedrepeated', words=['repeated', 'repe', 'atedre', 'peated']) == []",
"assert candidate(s='xyzxyzxyzxyz', words=['xyz', 'xyz', 'xyz', 'xyz']) == [0]",
"assert candidate(s='barfoothefoobarman', words=['foo', 'bar']) == [0, 9]",
"assert candidate(s='a... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nA permutation of an array of integers is an arrangement of its members int... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
A permutation of an array of integers is an arrangement of its members into a sequence or linear order.
For example, f... | [
"assert candidate(nums=[11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == None",
"assert candidate(nums=[1, 1, 1, 1, 1, 1, 1]) == None",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 100]) == None",
"assert candidate(nums=[1, 2, 2, 3, 3, 4, 5]) == None",
"assert candidate(nums=[1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == None",
"assert candidate(nums=[1, 1, 1, 1, 1, 1, 1]) == None",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 100]) == None",
"assert candidate(nums=[1, 2, 2, 3, 3, 4, 5]) == None",
"assert candidate(nums=[1, ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven a string containing just the characters '(' and ')', return the leng... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given a string containing just the characters '(' and ')', return the length of the longest valid (well-formed) parenth... | [
"assert candidate(s='(()(())())()()') == 14",
"assert candidate(s='(()(()(()(()(()(()(()(()(()(()(()(()(()))()))))))))))))))))))') == 54",
"assert candidate(s='()(()(((()))()))') == 16",
"assert candidate(s='((((()))))(((())))') == 18",
"assert candidate(s='(((()(()))(()(()))))') == 20",
"assert candidate... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='(()(())())()()') == 14",
"assert candidate(s='(()(()(()(()(()(()(()(()(()(()(()(()(()))()))))))))))))))))))') == 54",
"assert candidate(s='()(()(((()))()))') == 16",
"assert candidate(s='((((()))))(((())))') == 18",
"assert candidate(s='(((()(()))(()(()))))'... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nThere is an integer array nums sorted in ascending order (with distinct va... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
There is an integer array nums sorted in ascending order (with distinct values).
Prior to being passed to your function... | [
"assert candidate(nums=[50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an array of integers nums sorted in non-decreasing order, find the s... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given an array of integers nums sorted in non-decreasing order, find the starting and ending position of a given target... | [
"assert candidate(nums=[1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21], target=1) == [0, 0]",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7], target=7) == [6, 6]",
"assert candidate(nums=[2, 2, 2, 2, 3, 3, 4, 4, 4, 4], target=2) == [0, 3]",
"assert candidate(nums=[1, 2, 3, 3, 3, 3, 4, 5, 5, 5, 5, 6, 7, 8, 9, 10], targe... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21], target=1) == [0, 0]",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7], target=7) == [6, 6]",
"assert candidate(nums=[2, 2, 2, 2, 3, 3, 4, 4, 4, 4], target=2) == [0, 3]",
"assert candidate(nums=[1, 2, 3, 3, 3, 3, 4, 5, 5, 5... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nThe count-and-say sequence is a sequence of digit strings defined by the r... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
The count-and-say sequence is a sequence of digit strings defined by the recursive formula:
countAndSay(1) = "1"
count... | [
"assert candidate(n=9) == '31131211131221'",
"assert candidate(n=12) == '3113112221232112111312211312113211'",
"assert candidate(n=29) == '11131221131211132221232112111312111213111213211231132132211211131221232112111312211213111213122112132113213221123113112221133112132123222112111312211312112213211231132132211... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=9) == '31131211131221'",
"assert candidate(n=12) == '3113112221232112111312211312113211'",
"assert candidate(n=29) == '1113122113121113222123211211131211121311121321123113213221121113122123211211131221121311121312211213211321322112311311222113311213212322211211131221... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an array of distinct integers candidates and a target integer target... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given an array of distinct integers candidates and a target integer target, return a list of all unique combinations of... | [
"assert candidate(candidates=[11, 22, 33, 44, 55, 66, 77, 88, 99], target=198) == [[11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11], [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 22], [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 33], [11, 11, 11, 11, 11, 11... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(candidates=[11, 22, 33, 44, 55, 66, 77, 88, 99], target=198) == [[11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11], [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 22], [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 33], [1... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven a collection of candidate numbers (candidates) and a target number (... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in cand... | [
"assert candidate(candidates=[1], target=1) == [[1]]",
"assert candidate(candidates=[2, 3, 6, 7, 8, 10, 11, 13, 15], target=21) == [[2, 3, 6, 10], [2, 6, 13], [2, 8, 11], [3, 7, 11], [3, 8, 10], [6, 7, 8], [6, 15], [8, 13], [10, 11]]",
"assert candidate(candidates=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(candidates=[1], target=1) == [[1]]",
"assert candidate(candidates=[2, 3, 6, 7, 8, 10, 11, 13, 15], target=21) == [[2, 3, 6, 10], [2, 6, 13], [2, 8, 11], [3, 7, 11], [3, 8, 10], [6, 7, 8], [6, 15], [8, 13], [10, 11]]",
"assert candidate(candidates=[1, 1, 1, 1, 1, 1, 1, ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an unsorted integer array nums. Return the smallest positive integer... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given an unsorted integer array nums. Return the smallest positive integer that is not present in nums.
You must implem... | [
"assert candidate(nums=[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 11",
"assert candidate(nums=[100000, 100001, 100002, 100003, 100004, 100005, 100006, 100007, 100008, 100009, 1]) == 2",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 0]... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 11",
"assert candidate(nums=[100000, 100001, 100002, 100003, 100004, 100005, 100006, 100007, 100008, 100009, 1]) == 2",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 2... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven n non-negative integers representing an elevation map where the widt... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it... | [
"assert candidate(height=[1, 2, 3, 4, 3, 2, 1, 0, 1, 0, 1, 2, 3, 2, 1]) == 14",
"assert candidate(height=[0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == 8",
"assert candidate(height=[1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 1, 2]) == 12",
"assert candidate(height=[0, 2, 0, 2, 0, 3, 0, 3, 0, 2, 0, 2]) == 11",
... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(height=[1, 2, 3, 4, 3, 2, 1, 0, 1, 0, 1, 2, 3, 2, 1]) == 14",
"assert candidate(height=[0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]) == 8",
"assert candidate(height=[1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 1, 2]) == 12",
"assert candidate(height=[0, 2, 0, 2, 0, 3, ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven two non-negative integers num1 and num2 represented as strings, retu... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represe... | [
"assert candidate(num1='500000000000000000', num2='300000000000000000') == '150000000000000000000000000000000000'",
"assert candidate(num1='1111111111', num2='11111111111111111111') == '12345679011111111110987654321'",
"assert candidate(num1='5', num2='67890') == '339450'",
"assert candidate(num1='55555555555... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(num1='500000000000000000', num2='300000000000000000') == '150000000000000000000000000000000000'",
"assert candidate(num1='1111111111', num2='11111111111111111111') == '12345679011111111110987654321'",
"assert candidate(num1='5', num2='67890') == '339450'",
"assert ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an input string (s) and a pattern (p), implement wildcard pattern ma... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given an input string (s) and a pattern (p), implement wildcard pattern matching with support for '?' and '*' where:
'... | [
"assert candidate(s='abcabcabcabc', p='abc*abc*') == True",
"assert candidate(s='abcdefghij', p='a*b*c*d*e*f*g*h*i*j') == True",
"assert candidate(s='abcdabcdabcd', p='*a*b*c*d*a*b*c*d*a*b*c*d*') == True",
"assert candidate(s='abcdefghij', p='????a*b*c*d*e*f*g*h*i*j') == False",
"assert candidate(s='hello_w... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='abcabcabcabc', p='abc*abc*') == True",
"assert candidate(s='abcdefghij', p='a*b*c*d*e*f*g*h*i*j') == True",
"assert candidate(s='abcdabcdabcd', p='*a*b*c*d*a*b*c*d*a*b*c*d*') == True",
"assert candidate(s='abcdefghij', p='????a*b*c*d*e*f*g*h*i*j') == False",
... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an array nums of distinct integers, return all the possible permutat... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given an array nums of distinct integers, return all the possible permutations. You can return the answer in any order.... | [
"assert candidate(nums=[100, 200, 300, -100, -200, -300]) == [[100, 200, 300, -100, -200, -300], [100, 200, 300, -100, -300, -200], [100, 200, 300, -200, -100, -300], [100, 200, 300, -200, -300, -100], [100, 200, 300, -300, -100, -200], [100, 200, 300, -300, -200, -100], [100, 200, -100, 300, -200, -300], [100, 200... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[100, 200, 300, -100, -200, -300]) == [[100, 200, 300, -100, -200, -300], [100, 200, 300, -100, -300, -200], [100, 200, 300, -200, -100, -300], [100, 200, 300, -200, -300, -100], [100, 200, 300, -300, -100, -200], [100, 200, 300, -300, -200, -100], [100, 200, -100, 300, -... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven a collection of numbers, nums, that might contain duplicates, return... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given a collection of numbers, nums, that might contain duplicates, return all possible unique permutations in any orde... | [
"assert candidate(nums=[2, 2, 2, 1, 1]) == [[1, 1, 2, 2, 2], [1, 2, 1, 2, 2], [1, 2, 2, 1, 2], [1, 2, 2, 2, 1], [2, 1, 1, 2, 2], [2, 1, 2, 1, 2], [2, 1, 2, 2, 1], [2, 2, 1, 1, 2], [2, 2, 1, 2, 1], [2, 2, 2, 1, 1]]",
"assert candidate(nums=[1, 1, 1]) == [[1, 1, 1]]",
"assert candidate(nums=[8, 8, 8, 8, 8, 8, 8, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[2, 2, 2, 1, 1]) == [[1, 1, 2, 2, 2], [1, 2, 1, 2, 2], [1, 2, 2, 1, 2], [1, 2, 2, 2, 1], [2, 1, 1, 2, 2], [2, 1, 2, 1, 2], [2, 1, 2, 2, 1], [2, 2, 1, 1, 2], [2, 2, 1, 2, 1], [2, 2, 2, 1, 1]]",
"assert candidate(nums=[1, 1, 1]) == [[1, 1, 1]]",
"assert candidate(nu... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an n x n 2D matrix representing an image, rotate the image b... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an n x n 2D matrix representing an image, rotate the image by 90 degrees (clockwise).
You have to rotate ... | [
"assert candidate(matrix=[[1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12], [13, 14, 15, 16, 17, 18], [19, 20, 21, 22, 23, 24], [25, 26, 27, 28, 29, 30], [31, 32, 33, 34, 35, 36]]) == None",
"assert candidate(matrix=[[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]) == None",
"assert candidate(matrix=[[1000, -1... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(matrix=[[1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12], [13, 14, 15, 16, 17, 18], [19, 20, 21, 22, 23, 24], [25, 26, 27, 28, 29, 30], [31, 32, 33, 34, 35, 36]]) == None",
"assert candidate(matrix=[[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]) == None",
"assert ca... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nImplement pow(x, n), which calculates x raised to the power n (i.e., xn).\... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Implement pow(x, n), which calculates x raised to the power n (i.e., xn).
Constraints:
-100.0 < x < 100.0
-231 <= n ... | [
"assert candidate(x=-0.5, n=3) == -0.125",
"assert candidate(x=0.99999, n=1000000) == 4.539765980992338e-05",
"assert candidate(x=1.41421, n=50) == 33550206.11671562",
"assert candidate(x=3.0, n=20) == 3486784401.0",
"assert candidate(x=1.00001, n=-1000000) == 4.5402199796741926e-05",
"assert candidate(x=... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(x=-0.5, n=3) == -0.125",
"assert candidate(x=0.99999, n=1000000) == 4.539765980992338e-05",
"assert candidate(x=1.41421, n=50) == 33550206.11671562",
"assert candidate(x=3.0, n=20) == 3486784401.0",
"assert candidate(x=1.00001, n=-1000000) == 4.5402199796741926... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an integer array nums, find the subarray with the largest sum, and r... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given an integer array nums, find the subarray with the largest sum, and return its sum.
Constraints:
1 <= nums.leng... | [
"assert candidate(nums=[5, 4, -1, 7, 8, -20, 15, -10, 25, -5, 10, -30, 40, -50, 60]) == 60",
"assert candidate(nums=[1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15]) == 15",
"assert candidate(nums=[10, -10, 20, -20, 30, -30, 40, -40, 50]) == 50",
"assert candidate(nums=[-2, 0, -1]) == 0",
"assert ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[5, 4, -1, 7, 8, -20, 15, -10, 25, -5, 10, -30, 40, -50, 60]) == 60",
"assert candidate(nums=[1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15]) == 15",
"assert candidate(nums=[10, -10, 20, -20, 30, -30, 40, -40, 50]) == 50",
"assert candidate(nums=[-2... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an m x n matrix, return all elements of the matrix in spiral order.\... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given an m x n matrix, return all elements of the matrix in spiral order.
Constraints:
m == matrix.length
n == matri... | [
"assert candidate(matrix=[[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]]) == [1, 2, 3, 4, 5, 10, 9, 8, 7, 6]",
"assert candidate(matrix=[[1]]) == [1]",
"assert candidate(matrix=[[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12]]) == [1, 2, 4, 6, 8, 10, 12, 11, 9, 7, 5, 3]",
"assert candidate(matrix=[[1, 2, 3, 4, 5, 6, 7,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(matrix=[[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]]) == [1, 2, 3, 4, 5, 10, 9, 8, 7, 6]",
"assert candidate(matrix=[[1]]) == [1]",
"assert candidate(matrix=[[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12]]) == [1, 2, 4, 6, 8, 10, 12, 11, 9, 7, 5, 3]",
"assert candidate(ma... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an integer array nums. You are initially positioned at the a... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an integer array nums. You are initially positioned at the array's first index, and each element in the a... | [
"assert candidate(nums=[1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1]) == False",
"assert candidate(nums=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == False",
"assert candidate(nums=[1, 1, 2, 2, 1, 1, 1, 1, 1, 0, 0]) == False",
"assert candidate(nums=[2, 3, 1, 1, 4, 2, 3, 1, 1, 1]) == True",
"assert candidate(nums=[... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1]) == False",
"assert candidate(nums=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == False",
"assert candidate(nums=[1, 1, 2, 2, 1, 1, 1, 1, 1, 0, 0]) == False",
"assert candidate(nums=[2, 3, 1, 1, 4, 2, 3, 1, 1, 1]) == True",... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an array of intervals where intervals[i] = [starti, endi], merge all... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array o... | [
"assert candidate(intervals=[[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [1, 4], [3, 6], [5, 8], [7, 10], [1, 6], [3, 8], [5, 10], [1, 8], [3, 10], [1, 10]]) == [[1, 10]]",
"assert candidate(intervals=[[1, 3], [3, 7], [8, 10], [12, 15], [14, 17], [18, 20], [21, 22]]) == [[1, 7], [8, 10], [12, 17], [18, 20], [21, 22]... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(intervals=[[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [1, 4], [3, 6], [5, 8], [7, 10], [1, 6], [3, 8], [5, 10], [1, 8], [3, 10], [1, 10]]) == [[1, 10]]",
"assert candidate(intervals=[[1, 3], [3, 7], [8, 10], [12, 15], [14, 17], [18, 20], [21, 22]]) == [[1, 7], [8, 10], [12, ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an array of non-overlapping intervals intervals where interv... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an array of non-overlapping intervals intervals where intervals[i] = [starti, endi] represent the start a... | [
"assert candidate(intervals=[[1, 2], [4, 5], [7, 8], [10, 11], [13, 14]], newInterval=[3, 12]) == [[1, 2], [3, 12], [13, 14]]",
"assert candidate(intervals=[[1, 3], [5, 7], [8, 10], [12, 14], [16, 18]], newInterval=[15, 17]) == [[1, 3], [5, 7], [8, 10], [12, 14], [15, 18]]",
"assert candidate(intervals=[], newI... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(intervals=[[1, 2], [4, 5], [7, 8], [10, 11], [13, 14]], newInterval=[3, 12]) == [[1, 2], [3, 12], [13, 14]]",
"assert candidate(intervals=[[1, 3], [5, 7], [8, 10], [12, 14], [16, 18]], newInterval=[15, 17]) == [[1, 3], [5, 7], [8, 10], [12, 14], [15, 18]]",
"assert can... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven a positive integer n, generate an n x n matrix filled with elements ... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given a positive integer n, generate an n x n matrix filled with elements from 1 to n2 in spiral order.
Constraints:
... | [
"assert candidate(n=4) == [[1, 2, 3, 4], [12, 13, 14, 5], [11, 16, 15, 6], [10, 9, 8, 7]]",
"assert candidate(n=18) == [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18], [68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 19], [67, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=4) == [[1, 2, 3, 4], [12, 13, 14, 5], [11, 16, 15, 6], [10, 9, 8, 7]]",
"assert candidate(n=18) == [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18], [68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 19], [67, 128, 129, 130, 131, 132, 13... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nThe set [1, 2, 3, ..., n] contains a total of n! unique permutations.\nBy ... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
The set [1, 2, 3, ..., n] contains a total of n! unique permutations.
By listing and labeling all of the permutations i... | [
"assert candidate(n=9, k=98765) == '357214968'",
"assert candidate(n=9, k=362879) == '987654312'",
"assert candidate(n=9, k=270000) == '764985321'",
"assert candidate(n=2, k=2) == '21'",
"assert candidate(n=8, k=25921) == '62134578'",
"assert candidate(n=8, k=1) == '12345678'",
"assert candidate(n=5, k=... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=9, k=98765) == '357214968'",
"assert candidate(n=9, k=362879) == '987654312'",
"assert candidate(n=9, k=270000) == '764985321'",
"assert candidate(n=2, k=2) == '21'",
"assert candidate(n=8, k=25921) == '62134578'",
"assert candidate(n=8, k=1) == '12345678... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven the head of a linked list, rotate the list to the right by k places.... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given the head of a linked list, rotate the list to the right by k places.
Constraints:
The number of nodes in the l... | [
"assert is_same_list(candidate(head=list_node([7, 7, 7, 7, 7]), k=10), list_node([7, 7, 7, 7, 7]))",
"assert is_same_list(candidate(head=list_node([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), k=50), list_node([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))",
"assert is_same_list(candidate(head=list_node([9, 8, 7, 6, 5, 4, 3, 2, 1]), k=9)... | newfacade/LeetCodeDataset | {
"constraints": [
"assert is_same_list(candidate(head=list_node([7, 7, 7, 7, 7]), k=10), list_node([7, 7, 7, 7, 7]))",
"assert is_same_list(candidate(head=list_node([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), k=50), list_node([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))",
"assert is_same_list(candidate(head=list_node([9, 8, 7,... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nThere is a robot on an m x n grid. The robot is initially located at the t... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
There is a robot on an m x n grid. The robot is initially located at the top-left corner (i.e., grid[0][0]). The robot ... | [
"assert candidate(m=99, n=100) == 11375441539711467483090977019784442697802084130077052367000",
"assert candidate(m=80, n=80) == 23156006494021191956342707682359261381151378400",
"assert candidate(m=25, n=75) == 45931679871275969889300",
"assert candidate(m=25, n=25) == 32247603683100",
"assert candidate(m=... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(m=99, n=100) == 11375441539711467483090977019784442697802084130077052367000",
"assert candidate(m=80, n=80) == 23156006494021191956342707682359261381151378400",
"assert candidate(m=25, n=75) == 45931679871275969889300",
"assert candidate(m=25, n=25) == 322476036831... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven a m x n grid filled with non-negative numbers, find a path from top ... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right, which minimizes the sum... | [
"assert candidate(grid=[[1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [1, 3, 1, 5, 1], [2, 1, 2, 3, 4]]) == 17",
"assert candidate(grid=[[1, 2], [3, 4]]) == 7",
"assert candidate(grid=[[1, 9, 9, 9, 9], [1, 1, 9, 9, 9], [1, 1, 1, 9, 9], [1, 1, 1, 1, 9], [1, 1, 1, 1, 1]]) == 9",
"assert candidate(grid=[[9, 5, 4, 9, 6, 5, 6... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(grid=[[1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [1, 3, 1, 5, 1], [2, 1, 2, 3, 4]]) == 17",
"assert candidate(grid=[[1, 2], [3, 4]]) == 7",
"assert candidate(grid=[[1, 9, 9, 9, 9], [1, 1, 9, 9, 9], [1, 1, 1, 9, 9], [1, 1, 1, 1, 9], [1, 1, 1, 1, 1]]) == 9",
"assert candidate... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an array of strings words and a width maxWidth, format the text such... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given an array of strings words and a width maxWidth, format the text such that each line has exactly maxWidth characte... | [
"assert candidate(words=['Many', 'spaces', 'should', 'go', 'here'], maxWidth=23) == ['Many spaces should go', 'here ']",
"assert candidate(words=['Here', 'is', 'a', 'longer', 'word', 'that', 'will', 'require', 'some', 'additional', 'spaces', 'to', 'justify'], maxWidth=30) == ['Here is a lon... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(words=['Many', 'spaces', 'should', 'go', 'here'], maxWidth=23) == ['Many spaces should go', 'here ']",
"assert candidate(words=['Here', 'is', 'a', 'longer', 'word', 'that', 'will', 'require', 'some', 'additional', 'spaces', 'to', 'justify'], maxWidth=30... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an absolute path for a Unix-style file system, which always ... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an absolute path for a Unix-style file system, which always begins with a slash '/'. Your task is to tran... | [
"assert candidate(path='/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/../../../../../../../../../../a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/../../../../../../../../../../') == '/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p'",
"assert candidate(path='/home/user////....///........ | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(path='/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/../../../../../../../../../../a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/../../../../../../../../../../') == '/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p'",
"assert candidate(path='/ho... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven two strings word1 and word2, return the minimum number of operations... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given two strings word1 and word2, return the minimum number of operations required to convert word1 to word2.
You have... | [
"assert candidate(word1='dynamic', word2='programming') == 8",
"assert candidate(word1='algorithmic', word2='algebraic') == 6",
"assert candidate(word1='transformation', word2='transmogrification') == 6",
"assert candidate(word1='mississippi', word2='mississipi') == 1",
"assert candidate(word1='acknowledgme... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(word1='dynamic', word2='programming') == 8",
"assert candidate(word1='algorithmic', word2='algebraic') == 6",
"assert candidate(word1='transformation', word2='transmogrification') == 6",
"assert candidate(word1='mississippi', word2='mississipi') == 1",
"assert ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an m x n integer matrix matrix, if an element is 0, set its entire r... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given an m x n integer matrix matrix, if an element is 0, set its entire row and column to 0's.
You must do it in place... | [
"assert candidate(matrix=[[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]) == None",
"assert candidate(matrix=[[1, 2, 3, 4, 5, 6], [7, 8, 9, 0, 11, 12], [13, 14, 15, 16, 17, 18], [19, 20, 21, 22, 23, 24]]) == None",
"assert candidate(matrix=[[1, 2, 3], [4, 5, 6], [7, 8, 9], [0, 11, 12], [13,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(matrix=[[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]) == None",
"assert candidate(matrix=[[1, 2, 3, 4, 5, 6], [7, 8, 9, 0, 11, 12], [13, 14, 15, 16, 17, 18], [19, 20, 21, 22, 23, 24]]) == None",
"assert candidate(matrix=[[1, 2, 3], [4, 5, 6], [7,... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an m x n integer matrix matrix with the following two proper... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an m x n integer matrix matrix with the following two properties:
Each row is sorted in non-decreasing o... | [
"assert candidate(matrix=[[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16], [17, 18, 19, 20]], target=1) == True",
"assert candidate(matrix=[[1, 2, 3], [4, 5, 6], [7, 8, 9]], target=10) == False",
"assert candidate(matrix=[[1, 3]], target=3) == True",
"assert candidate(matrix=[[1, 3, 5, 7], [10, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(matrix=[[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16], [17, 18, 19, 20]], target=1) == True",
"assert candidate(matrix=[[1, 2, 3], [4, 5, 6], [7, 8, 9]], target=10) == False",
"assert candidate(matrix=[[1, 3]], target=3) == True",
"assert candidate(... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an array nums with n objects colored red, white, or blue, sort them ... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given an array nums with n objects colored red, white, or blue, sort them in-place so that objects of the same color ar... | [
"assert candidate(nums=[1, 1, 1, 2, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0, 1, 1, 1]) == None",
"assert candidate(nums=[1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2]) == None",
"assert candidate(nums=[0, 1, 1, 0, 1, 2, 1, 2, 2, 0]) == None",
"assert candidate(nums=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 1, 1, 2, 2, 2, 0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 0, 0, 1, 1, 1]) == None",
"assert candidate(nums=[1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2]) == None",
"assert candidate(nums=[0, 1, 1, 0, 1, 2, 1, 2, 2, 0]) == None",
"assert candidate(nums=[1, 1, 1, 1, 1, 1... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven two strings s and t of lengths m and n respectively, return the mini... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given two strings s and t of lengths m and n respectively, return the minimum window substring of s such that every cha... | [
"assert candidate(s='abccbaacz', t='abc') == 'abc'",
"assert candidate(s='bbaaaaaaabbbbcccc', t='aabbbccc') == 'aabbbbccc'",
"assert candidate(s='bbaabbbbbaabbbbaaabbbbaaabbababababab', t='bbbbaaaa') == 'aabbbbaa'",
"assert candidate(s='abcabcabcabcabc', t='cba') == 'abc'",
"assert candidate(s='xyzzzyxzyxzy... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='abccbaacz', t='abc') == 'abc'",
"assert candidate(s='bbaaaaaaabbbbcccc', t='aabbbccc') == 'aabbbbccc'",
"assert candidate(s='bbaabbbbbaabbbbaaabbbbaaabbababababab', t='bbbbaaaa') == 'aabbbbaa'",
"assert candidate(s='abcabcabcabcabc', t='cba') == 'abc'",
"ass... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven two integers n and k, return all possible combinations of k numbers ... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given two integers n and k, return all possible combinations of k numbers chosen from the range [1, n].
You may return ... | [
"assert candidate(n=13, k=2) == [[1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [3, 10], [3, 11], [3, 12], [3, 13], [4, 5],... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=13, k=2) == [[1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1, 12], [1, 13], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [2, 10], [2, 11], [2, 12], [2, 13], [3, 4], [3, 5], [3, 6], [3, 7], [3, 8], [3, 9], [3, 10], [3, 11], [3, ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an integer array nums of unique elements, return all possible subset... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given an integer array nums of unique elements, return all possible subsets (the power set).
The solution set must not ... | [
"assert candidate(nums=[1, 2, 3, 4]) == [[], [4], [3], [3, 4], [2], [2, 4], [2, 3], [2, 3, 4], [1], [1, 4], [1, 3], [1, 3, 4], [1, 2], [1, 2, 4], [1, 2, 3], [1, 2, 3, 4]]",
"assert candidate(nums=[5, 3, 8, 6, 2, 7, 4, 1]) == [[], [1], [4], [4, 1], [7], [7, 1], [7, 4], [7, 4, 1], [2], [2, 1], [2, 4], [2, 4, 1], [2... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 2, 3, 4]) == [[], [4], [3], [3, 4], [2], [2, 4], [2, 3], [2, 3, 4], [1], [1, 4], [1, 3], [1, 3, 4], [1, 2], [1, 2, 4], [1, 2, 3], [1, 2, 3, 4]]",
"assert candidate(nums=[5, 3, 8, 6, 2, 7, 4, 1]) == [[], [1], [4], [4, 1], [7], [7, 1], [7, 4], [7, 4, 1], [2], [2, 1]... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an m x n grid of characters board and a string word, return true if ... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given an m x n grid of characters board and a string word, return true if word exists in the grid.
The word can be cons... | [
"assert candidate(board=[['A', 'B'], ['C', 'D']], word='BD') == True",
"assert candidate(board=[['A', 'B', 'C', 'E'], ['S', 'F', 'C', 'S'], ['A', 'D', 'E', 'E']], word='Z') == False",
"assert candidate(board=[['A', 'B', 'C', 'E'], ['S', 'F', 'C', 'S'], ['A', 'D', 'E', 'E']], word='SEE') == True",
"assert cand... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(board=[['A', 'B'], ['C', 'D']], word='BD') == True",
"assert candidate(board=[['A', 'B', 'C', 'E'], ['S', 'F', 'C', 'S'], ['A', 'D', 'E', 'E']], word='Z') == False",
"assert candidate(board=[['A', 'B', 'C', 'E'], ['S', 'F', 'C', 'S'], ['A', 'D', 'E', 'E']], word='SEE')... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an integer array nums sorted in non-decreasing order, remove some du... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given an integer array nums sorted in non-decreasing order, remove some duplicates in-place such that each unique eleme... | [
"assert candidate(nums=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4]) == 8",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 30",
"assert candidate(nums=[1, 1, 1, 1, 1... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4]) == 8",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]) == 30",
"assert cand... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nThere is an integer array nums sorted in non-decreasing order (not necessa... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
There is an integer array nums sorted in non-decreasing order (not necessarily with distinct values).
Before being pass... | [
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 0], target=20) == False",
"assert candidate(nums=[4, 5, 6, 7, 0, 1, 2], target=0) == True",
"assert candidate(nums=[5, 1, 3], target=3) == True",
"assert candidate(nums=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 0], target=20) == False",
"assert candidate(nums=[4, 5, 6, 7, 0, 1, 2], target=0) == True",
"assert candidate(nums=[5, 1, 3], target=3) == True",
"assert candidate(nums=[0, 1, 2, 3, 4, 5, 6, 7... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven the head of a sorted linked list, delete all nodes that have duplica... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given the head of a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers fro... | [
"assert is_same_list(candidate(head=list_node([1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8])), list_node([1]))",
"assert is_same_list(candidate(head=list_node([-100, -99, -99, -98, -98, -97, -96, -96, -95, -94, -93, -93, -92])), list_node([-100, -97, -95, -94, -92]))",... | newfacade/LeetCodeDataset | {
"constraints": [
"assert is_same_list(candidate(head=list_node([1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8])), list_node([1]))",
"assert is_same_list(candidate(head=list_node([-100, -99, -99, -98, -98, -97, -96, -96, -95, -94, -93, -93, -92])), list_node([-100, ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an array of integers heights representing the histogram's bar height... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given an array of integers heights representing the histogram's bar height where the width of each bar is 1, return the... | [
"assert candidate(heights=[0, 9, 0, 8, 0, 7, 0, 6, 0, 5, 0, 4, 0, 3, 0, 2, 0, 1]) == 9",
"assert candidate(heights=[4, 2, 0, 3, 2, 5, 6, 0, 0, 1]) == 10",
"assert candidate(heights=[0, 0, 0, 0, 0]) == 0",
"assert candidate(heights=[1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1]) == 17",
"assert candidat... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(heights=[0, 9, 0, 8, 0, 7, 0, 6, 0, 5, 0, 4, 0, 3, 0, 2, 0, 1]) == 9",
"assert candidate(heights=[4, 2, 0, 3, 2, 5, 6, 0, 0, 1]) == 10",
"assert candidate(heights=[0, 0, 0, 0, 0]) == 0",
"assert candidate(heights=[1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1])... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven a rows x cols binary matrix filled with 0's and 1's, find the larges... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given a rows x cols binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return it... | [
"assert candidate(matrix=[['1', '0', '1', '0', '1', '0', '1', '0'], ['0', '1', '0', '1', '0', '1', '0', '1'], ['1', '0', '1', '0', '1', '0', '1', '0'], ['0', '1', '0', '1', '0', '1', '0', '1']]) == 1",
"assert candidate(matrix=[['0', '1', '0', '1'], ['1', '0', '1', '0'], ['0', '1', '0', '1']]) == 1",
"assert ca... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(matrix=[['1', '0', '1', '0', '1', '0', '1', '0'], ['0', '1', '0', '1', '0', '1', '0', '1'], ['1', '0', '1', '0', '1', '0', '1', '0'], ['0', '1', '0', '1', '0', '1', '0', '1']]) == 1",
"assert candidate(matrix=[['0', '1', '0', '1'], ['1', '0', '1', '0'], ['0', '1', '0', '1'... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven the head of a linked list and a value x, partition it such that all ... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given the head of a linked list and a value x, partition it such that all nodes less than x come before nodes greater t... | [
"assert is_same_list(candidate(head=list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), x=1), list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]))",
"assert is_same_list(candidate(head=list_node([5, 1, 8, 3, 6, 2, 7, 4]), x=5), list_node([1, 3, 2, 4, 5, 8, 6, 7]))",
"assert is_same_list(candidate(head=list_node([-100, 100, 0]),... | newfacade/LeetCodeDataset | {
"constraints": [
"assert is_same_list(candidate(head=list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]), x=1), list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]))",
"assert is_same_list(candidate(head=list_node([5, 1, 8, 3, 6, 2, 7, 4]), x=5), list_node([1, 3, 2, 4, 5, 8, 6, 7]))",
"assert is_same_list(candidate(head=l... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nWe can scramble a string s to get a string t using the following algorithm... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
We can scramble a string s to get a string t using the following algorithm:
If the length of the string is 1, stop.
If... | [
"assert candidate(s1='abcdefgh', s2='abcdghfe') == True",
"assert candidate(s1='abcdefghij', s2='bcdefghiaj') == True",
"assert candidate(s1='abcdefghij', s2='abjihgfedc') == True",
"assert candidate(s1='interview', s2='ewrotnive') == False",
"assert candidate(s1='hello', s2='lohel') == True",
"assert can... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s1='abcdefgh', s2='abcdghfe') == True",
"assert candidate(s1='abcdefghij', s2='bcdefghiaj') == True",
"assert candidate(s1='abcdefghij', s2='abjihgfedc') == True",
"assert candidate(s1='interview', s2='ewrotnive') == False",
"assert candidate(s1='hello', s2='lo... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nAn n-bit gray code sequence is a sequence of 2n integers where:\n\nEvery i... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
An n-bit gray code sequence is a sequence of 2n integers where:
Every integer is in the inclusive range [0, 2n - 1],
T... | [
"assert candidate(n=2) == [0, 1, 3, 2]",
"assert candidate(n=5) == [0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16]",
"assert candidate(n=12) == [0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=2) == [0, 1, 3, 2]",
"assert candidate(n=5) == [0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 30, 31, 29, 28, 20, 21, 23, 22, 18, 19, 17, 16]",
"assert candidate(n=12) == [0, 1, 3, 2, 6, 7, 5, 4, 12, 13, 15, 14, 10, 11, 9, 8, 24, 25, 27, 26, 3... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an integer array nums that may contain duplicates, return all possib... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given an integer array nums that may contain duplicates, return all possible subsets (the power set).
The solution set ... | [
"assert candidate(nums=[-1, -2, -3, -4, -1, -2, -3, -4]) == [[-4, -4, -3, -3, -2, -2, -1, -1], [-4, -4, -3, -3, -2, -2, -1], [-4, -4, -3, -3, -2, -2], [-4, -4, -3, -3, -2, -1, -1], [-4, -4, -3, -3, -2, -1], [-4, -4, -3, -3, -2], [-4, -4, -3, -3, -1, -1], [-4, -4, -3, -3, -1], [-4, -4, -3, -3], [-4, -4, -3, -2, -2, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[-1, -2, -3, -4, -1, -2, -3, -4]) == [[-4, -4, -3, -3, -2, -2, -1, -1], [-4, -4, -3, -3, -2, -2, -1], [-4, -4, -3, -3, -2, -2], [-4, -4, -3, -3, -2, -1, -1], [-4, -4, -3, -3, -2, -1], [-4, -4, -3, -3, -2], [-4, -4, -3, -3, -1, -1], [-4, -4, -3, -3, -1], [-4, -4, -3, -3], ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nA valid IP address consists of exactly four integers separated by single d... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
A valid IP address consists of exactly four integers separated by single dots. Each integer is between 0 and 255 (inclu... | [
"assert candidate(s='255255255255255255255') == []",
"assert candidate(s='991871283712983712987123789') == []",
"assert candidate(s='123456789012345') == []",
"assert candidate(s='00000000000000000000') == []",
"assert candidate(s='255025502550') == []",
"assert candidate(s='100100100') == ['10.0.100.100'... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='255255255255255255255') == []",
"assert candidate(s='991871283712983712987123789') == []",
"assert candidate(s='123456789012345') == []",
"assert candidate(s='00000000000000000000') == []",
"assert candidate(s='255025502550') == []",
"assert candidate(s=... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an integer n, return the number of structurally unique BST's (binary... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given an integer n, return the number of structurally unique BST's (binary search trees) which has exactly n nodes of u... | [
"assert candidate(n=10) == 16796",
"assert candidate(n=1) == 1",
"assert candidate(n=4) == 14",
"assert candidate(n=3) == 5",
"assert candidate(n=19) == 1767263190",
"assert candidate(n=8) == 1430",
"assert candidate(n=6) == 132",
"assert candidate(n=9) == 4862",
"assert candidate(n=7) == 429",
"a... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=10) == 16796",
"assert candidate(n=1) == 1",
"assert candidate(n=4) == 14",
"assert candidate(n=3) == 5",
"assert candidate(n=19) == 1767263190",
"assert candidate(n=8) == 1430",
"assert candidate(n=6) == 132",
"assert candidate(n=9) == 4862",
... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven strings s1, s2, and s3, find whether s3 is formed by an interleaving... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given strings s1, s2, and s3, find whether s3 is formed by an interleaving of s1 and s2.
An interleaving of two strings... | [
"assert candidate(s1='aa', s2='aa', s3='aaaa') == True",
"assert candidate(s1='', s2='z', s3='z') == True",
"assert candidate(s1='abc', s2='def', s3='abdecf') == True",
"assert candidate(s1='abc', s2='abc', s3='aabbcc') == True",
"assert candidate(s1='aabcc', s2='dbbca', s3='aadbbcbcacd') == False",
"asse... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s1='aa', s2='aa', s3='aaaa') == True",
"assert candidate(s1='', s2='z', s3='z') == True",
"assert candidate(s1='abc', s2='def', s3='abdecf') == True",
"assert candidate(s1='abc', s2='abc', s3='aabbcc') == True",
"assert candidate(s1='aabcc', s2='dbbca', s3='aad... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven the root of a binary tree, determine if it is a valid binary search ... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given the root of a binary tree, determine if it is a valid binary search tree (BST).
A valid BST is defined as follows... | [
"assert candidate(root=tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])) == False",
"assert candidate(root=tree_node([5, 3, 7, 2, 4, 6, 8, None, None, None, None, None, None, None, 9])) == True",
"assert candidate(root=tree_node([3, 1, 5, 0, 2, 4, 6, None, None, None, 3])) == False",
"assert candidate... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(root=tree_node([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])) == False",
"assert candidate(root=tree_node([5, 3, 7, 2, 4, 6, 8, None, None, None, None, None, None, None, 9])) == True",
"assert candidate(root=tree_node([3, 1, 5, 0, 2, 4, 6, None, None, None, 3])) == Fa... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven the root of a binary tree, return the zigzag level order traversal o... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given the root of a binary tree, return the zigzag level order traversal of its nodes' values. (i.e., from left to righ... | [
"assert candidate(root=tree_node([1, None, 2, None, None, None, None, 3, None, None, None, None, None, 4])) == [[1], [2]]",
"assert candidate(root=tree_node([2, 1, 3, 4, None, 5, 7, None, None, None, 6, None, 8, 9, 10])) == [[2], [3, 1], [4, 5, 7], [8, 6], [9, 10]]",
"assert candidate(root=tree_node([1, 2, 3, 4... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(root=tree_node([1, None, 2, None, None, None, None, 3, None, None, None, None, None, 4])) == [[1], [2]]",
"assert candidate(root=tree_node([2, 1, 3, 4, None, 5, 7, None, None, None, 6, None, 8, 9, 10])) == [[2], [3, 1], [4, 5, 7], [8, 6], [9, 10]]",
"assert candidate(r... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven two integer arrays preorder and inorder where preorder is the preord... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given two integer arrays preorder and inorder where preorder is the preorder traversal of a binary tree and inorder is ... | [
"assert is_same_tree(candidate(preorder=[10, 6, 2, 1, 3, 8, 5, 7, 12, 11, 13], inorder=[1, 2, 3, 6, 5, 7, 8, 10, 11, 12, 13]), tree_node([10, 6, 12, 2, 8, 11, 13, 1, 3, 5, None, None, None, None, None, None, None, None, None, None, 7]))",
"assert is_same_tree(candidate(preorder=[25, 15, 10, 5, 3, 2, 4, 12, 11, 13... | newfacade/LeetCodeDataset | {
"constraints": [
"assert is_same_tree(candidate(preorder=[10, 6, 2, 1, 3, 8, 5, 7, 12, 11, 13], inorder=[1, 2, 3, 6, 5, 7, 8, 10, 11, 12, 13]), tree_node([10, 6, 12, 2, 8, 11, 13, 1, 3, 5, None, None, None, None, None, None, None, None, None, None, 7]))",
"assert is_same_tree(candidate(preorder=[25, 15, 10,... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven two integer arrays inorder and postorder where inorder is the inorde... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given two integer arrays inorder and postorder where inorder is the inorder traversal of a binary tree and postorder is... | [
"assert is_same_tree(candidate(inorder=[4, 2, 5, 1, 6, 9, 8, 7, 3, 11, 10], postorder=[4, 5, 2, 6, 9, 7, 8, 1, 11, 10, 3]), tree_node([3, 1, 10, 2, 8, 11, None, 4, 5, 9, 7, None, None, None, None, None, None, 6]))",
"assert is_same_tree(candidate(inorder=[8, 4, 9, 2, 10, 5, 11, 1, 12, 6, 13, 3, 14, 7, 15], postor... | newfacade/LeetCodeDataset | {
"constraints": [
"assert is_same_tree(candidate(inorder=[4, 2, 5, 1, 6, 9, 8, 7, 3, 11, 10], postorder=[4, 5, 2, 6, 9, 7, 8, 1, 11, 10, 3]), tree_node([3, 1, 10, 2, 8, 11, None, 4, 5, 9, 7, None, None, None, None, None, None, 6]))",
"assert is_same_tree(candidate(inorder=[8, 4, 9, 2, 10, 5, 11, 1, 12, 6, 13... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven the root of a binary tree, return the bottom-up level order traversa... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given the root of a binary tree, return the bottom-up level order traversal of its nodes' values. (i.e., from left to r... | [
"assert candidate(root=tree_node([5, 1, 4, None, None, 3, 6])) == [[3, 6], [1, 4], [5]]",
"assert candidate(root=tree_node([5, 4, 8, 11, None, 13, 4, 7, 2, None, None, None, 1])) == [[7, 2, 1], [11, 13, 4], [4, 8], [5]]",
"assert candidate(root=tree_node([1, None, 2, None, 3, None, 4, None, 5])) == [[5], [4], [... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(root=tree_node([5, 1, 4, None, None, 3, 6])) == [[3, 6], [1, 4], [5]]",
"assert candidate(root=tree_node([5, 4, 8, 11, None, 13, 4, 7, 2, None, None, None, 1])) == [[7, 2, 1], [11, 13, 4], [4, 8], [5]]",
"assert candidate(root=tree_node([1, None, 2, None, 3, None, 4, N... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven the head of a singly linked list where elements are sorted in ascend... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given the head of a singly linked list where elements are sorted in ascending order, convert it to a height-balanced bi... | [
"assert is_same_tree(candidate(head=list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])), tree_node([8, 4, 12, 2, 6, 10, 14, 1, 3, 5, 7, 9, 11, 13, 15]))",
"assert is_same_tree(candidate(head=list_node([-999, -888, -777, -666, -555, -444, -333, -222, -111, 0, 111, 222, 333, 444, 555, 666, 777, 888, 999... | newfacade/LeetCodeDataset | {
"constraints": [
"assert is_same_tree(candidate(head=list_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])), tree_node([8, 4, 12, 2, 6, 10, 14, 1, 3, 5, 7, 9, 11, 13, 15]))",
"assert is_same_tree(candidate(head=list_node([-999, -888, -777, -666, -555, -444, -333, -222, -111, 0, 111, 222, 333, 444, ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven the root of a binary tree and an integer targetSum, return all root-... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given the root of a binary tree and an integer targetSum, return all root-to-leaf paths where the sum of the node value... | [
"assert candidate(root=tree_node([5, 4, 8, 11, None, 13, 4, 7, 2, None, None, 5, 1]), targetSum=27) == [[5, 4, 11, 7]]",
"assert candidate(root=tree_node([10, 5, 15, 3, 7, None, 18]), targetSum=25) == []",
"assert candidate(root=tree_node([1, 2, 3]), targetSum=5) == []",
"assert candidate(root=tree_node([1, 2... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(root=tree_node([5, 4, 8, 11, None, 13, 4, 7, 2, None, None, 5, 1]), targetSum=27) == [[5, 4, 11, 7]]",
"assert candidate(root=tree_node([10, 5, 15, 3, 7, None, 18]), targetSum=25) == []",
"assert candidate(root=tree_node([1, 2, 3]), targetSum=5) == []",
"assert can... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven the root of a binary tree, flatten the tree into a \"linked list\":\... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given the root of a binary tree, flatten the tree into a "linked list":
The "linked list" should use the same TreeNode... | [
"assert candidate(root=tree_node([1, 2, 3, 4, 5, 6, 7, 8, None, None, None, None, None, None, None, 9, 10, 11, 12, None, None, None, None, 13, None, 14, None, 15, None, 16])) == None",
"assert candidate(root=tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, None, None, None, None, None, No... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(root=tree_node([1, 2, 3, 4, 5, 6, 7, 8, None, None, None, None, None, None, None, 9, 10, 11, 12, None, None, None, None, 13, None, 14, None, 15, None, 16])) == None",
"assert candidate(root=tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, None, None, None, Non... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven two strings s and t, return the number of distinct subsequences of s... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given two strings s and t, return the number of distinct subsequences of s which equals t.
The test cases are generated... | [
"assert candidate(s='abcdefghijklmnopqrstuvwxyz', t='acegikmoqsuwy') == 1",
"assert candidate(s='mixedcharacters', t='mix') == 1",
"assert candidate(s='abcabcabcabcabcabcabcabc', t='abcabc') == 924",
"assert candidate(s='pneumonoultramicroscopicsilicovolcanoconiosis', t='pneumo') == 23",
"assert candidate(s... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='abcdefghijklmnopqrstuvwxyz', t='acegikmoqsuwy') == 1",
"assert candidate(s='mixedcharacters', t='mix') == 1",
"assert candidate(s='abcabcabcabcabcabcabcabc', t='abcabc') == 924",
"assert candidate(s='pneumonoultramicroscopicsilicovolcanoconiosis', t='pneumo') ==... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an integer array prices where prices[i] is the price of a gi... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an integer array prices where prices[i] is the price of a given stock on the ith day.
On each day, you ma... | [
"assert candidate(prices=[10, 1, 10, 1, 10, 1, 10, 1, 10, 1]) == 36",
"assert candidate(prices=[10, 9, 8, 2]) == 0",
"assert candidate(prices=[7, 1, 5, 3, 6, 4, 2, 8, 3, 10, 2, 5, 8, 12]) == 30",
"assert candidate(prices=[1, 9, 6, 9, 1, 7, 1, 1, 5, 9, 9, 9]) == 25",
"assert candidate(prices=[8, 6, 4, 3, 3, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(prices=[10, 1, 10, 1, 10, 1, 10, 1, 10, 1]) == 36",
"assert candidate(prices=[10, 9, 8, 2]) == 0",
"assert candidate(prices=[7, 1, 5, 3, 6, 4, 2, 8, 3, 10, 2, 5, 8, 12]) == 30",
"assert candidate(prices=[1, 9, 6, 9, 1, 7, 1, 1, 5, 9, 9, 9]) == 25",
"assert cand... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an array prices where prices[i] is the price of a given stoc... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an array prices where prices[i] is the price of a given stock on the ith day.
Find the maximum profit you... | [
"assert candidate(prices=[100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100]) == 0",
"assert candidate(prices=[1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39]) == 38",
"assert candidate(prices=[80, 70, 60, 50, 40, 30, 20, 10]) == 0",
... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(prices=[100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100]) == 0",
"assert candidate(prices=[1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39]) == 38",
"assert candidate(prices=[80, 70, 60, 50, 4... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nA path in a binary tree is a sequence of nodes where each pair of adjacent... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
A path in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting... | [
"assert candidate(root=tree_node([100, 50, 200, 25, 75, 150, 300, 10, 40, 60, 90, 125, 175, 250, 350])) == 1175",
"assert candidate(root=tree_node([0, -10, 7, 8, None, 15, None, -8, None, 5, None, 9, 6, 11, None, None, None, None, None, None, None, None, None, None, None])) == 38",
"assert candidate(root=tree_n... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(root=tree_node([100, 50, 200, 25, 75, 150, 300, 10, 40, 60, 90, 125, 175, 250, 350])) == 1175",
"assert candidate(root=tree_node([0, -10, 7, 8, None, 15, None, -8, None, 5, None, 9, 6, 11, None, None, None, None, None, None, None, None, None, None, None])) == 38",
"ass... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given the root of a binary tree containing digits from 0 to 9 only... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given the root of a binary tree containing digits from 0 to 9 only.
Each root-to-leaf path in the tree represen... | [
"assert candidate(root=tree_node([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5])) == 19397",
"assert candidate(root=tree_node([9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9])) == 79992",
"assert candidate(root=tree_node([9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, N... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(root=tree_node([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5])) == 19397",
"assert candidate(root=tree_node([9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9])) == 79992",
"assert candidate(root=tree_node([9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an m x n matrix board containing letters 'X' and 'O', captur... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an m x n matrix board containing letters 'X' and 'O', capture regions that are surrounded:
Connect: A ce... | [
"assert candidate(board=[['X', 'O', 'X', 'O', 'X', 'O', 'X', 'O', 'X', 'O'], ['O', 'X', 'O', 'X', 'O', 'X', 'O', 'X', 'O', 'X'], ['X', 'O', 'X', 'O', 'X', 'O', 'X', 'O', 'X', 'O'], ['O', 'X', 'O', 'X', 'O', 'X', 'O', 'X', 'O', 'X'], ['X', 'O', 'X', 'O', 'X', 'O', 'X', 'O', 'X', 'O'], ['O', 'X', 'O', 'X', 'O', 'X', ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(board=[['X', 'O', 'X', 'O', 'X', 'O', 'X', 'O', 'X', 'O'], ['O', 'X', 'O', 'X', 'O', 'X', 'O', 'X', 'O', 'X'], ['X', 'O', 'X', 'O', 'X', 'O', 'X', 'O', 'X', 'O'], ['O', 'X', 'O', 'X', 'O', 'X', 'O', 'X', 'O', 'X'], ['X', 'O', 'X', 'O', 'X', 'O', 'X', 'O', 'X', 'O'], ['O', 'X',... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven a string s, partition s such that every substring of the partition i... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrom... | [
"assert candidate(s='zzzz') == [['z', 'z', 'z', 'z'], ['z', 'z', 'zz'], ['z', 'zz', 'z'], ['z', 'zzz'], ['zz', 'z', 'z'], ['zz', 'zz'], ['zzz', 'z'], ['zzzz']]",
"assert candidate(s='levelrefer') == [['l', 'e', 'v', 'e', 'l', 'r', 'e', 'f', 'e', 'r'], ['l', 'e', 'v', 'e', 'l', 'r', 'efe', 'r'], ['l', 'e', 'v', 'e... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='zzzz') == [['z', 'z', 'z', 'z'], ['z', 'z', 'zz'], ['z', 'zz', 'z'], ['z', 'zzz'], ['zz', 'z', 'z'], ['zz', 'zz'], ['zzz', 'z'], ['zzzz']]",
"assert candidate(s='levelrefer') == [['l', 'e', 'v', 'e', 'l', 'r', 'e', 'f', 'e', 'r'], ['l', 'e', 'v', 'e', 'l', 'r', 'efe', '... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven a string s, partition s such that every substring of the partition i... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given a string s, partition s such that every substring of the partition is a palindrome.
Return the minimum cuts neede... | [
"assert candidate(s='aaaaaaaaaabbbbbbbbbccccccccc') == 2",
"assert candidate(s='aaaaabbbbb') == 1",
"assert candidate(s='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa') == 0",
"assert candidate(s='noonnoonnoonnoon') == 0",
"assert candidate(s='abcdabcdabcdabcdabcd') == 19",
... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='aaaaaaaaaabbbbbbbbbccccccccc') == 2",
"assert candidate(s='aaaaabbbbb') == 1",
"assert candidate(s='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa') == 0",
"assert candidate(s='noonnoonnoonnoon') == 0",
"assert candidate(s='abcd... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nThere are n gas stations along a circular route, where the amount of gas a... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
There are n gas stations along a circular route, where the amount of gas at the ith station is gas[i].
You have a car w... | [
"assert candidate(gas=[2, 3, 4, 5, 6, 7, 8, 9, 10], cost=[3, 4, 5, 6, 7, 8, 9, 10, 2]) == 8",
"assert candidate(gas=[3, 3, 4, 5, 1, 2], cost=[4, 1, 5, 1, 2, 3]) == 3",
"assert candidate(gas=[10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10], cost=[9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(gas=[2, 3, 4, 5, 6, 7, 8, 9, 10], cost=[3, 4, 5, 6, 7, 8, 9, 10, 2]) == 8",
"assert candidate(gas=[3, 3, 4, 5, 1, 2], cost=[4, 1, 5, 1, 2, 3]) == 3",
"assert candidate(gas=[10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10], cost=[9, 9, 9, ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nThere are n children standing in a line. Each child is assigned a rating v... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
There are n children standing in a line. Each child is assigned a rating value given in the integer array ratings.
You ... | [
"assert candidate(ratings=[1, 2, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1]) == 48",
"assert candidate(ratings=[20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 210",
"assert candidate(ratings=[7, 3, 5, 4, 6, 5, 4, 3, 5, 6, 7]) == 25",
"assert candidate(ratings=[1, 3, 2, 1, 2... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(ratings=[1, 2, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1]) == 48",
"assert candidate(ratings=[20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 210",
"assert candidate(ratings=[7, 3, 5, 4, 6, 5, 4, 3, 5, 6, 7]) == 25",
"assert candi... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven a string s and a dictionary of strings wordDict, return true if s ca... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given a string s and a dictionary of strings wordDict, return true if s can be segmented into a space-separated sequenc... | [
"assert candidate(s='thisisatest', wordDict=['this', 'is', 'a', 'test', 'thisis', 'isatest']) == True",
"assert candidate(s='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab', wordDict=['a', 'aa', 'aaa', 'aaaa',... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='thisisatest', wordDict=['this', 'is', 'a', 'test', 'thisis', 'isatest']) == True",
"assert candidate(s='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab', wordDict=['a... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven a string s and a dictionary of strings wordDict, add spaces in s to ... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given a string s and a dictionary of strings wordDict, add spaces in s to construct a sentence where each word is a val... | [
"assert candidate(s='aaaaaaa', wordDict=['aa', 'aaa']) == ['aa aa aaa', 'aa aaa aa', 'aaa aa aa']",
"assert candidate(s='thisproblemiswaytoolongtobreakdownintosmallervariables', wordDict=['this', 'problem', 'is', 'way', 'too', 'long', 'to', 'be', 'broken', 'down', 'into', 'smaller', 'variables', 'break', 'down', ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='aaaaaaa', wordDict=['aa', 'aaa']) == ['aa aa aaa', 'aa aaa aa', 'aaa aa aa']",
"assert candidate(s='thisproblemiswaytoolongtobreakdownintosmallervariables', wordDict=['this', 'problem', 'is', 'way', 'too', 'long', 'to', 'be', 'broken', 'down', 'into', 'smaller', 'variab... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven the head of a singly linked list, sort the list using insertion sort... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given the head of a singly linked list, sort the list using insertion sort, and return the sorted list's head.
The step... | [
"assert is_same_list(candidate(head=list_node([9999, 9998, 9997, 9996, 9995, 9994, 9993, 9992, 9991, 9990])), list_node([9990, 9991, 9992, 9993, 9994, 9995, 9996, 9997, 9998, 9999]))",
"assert is_same_list(candidate(head=list_node([1, 2, 3, 4, 5])), list_node([1, 2, 3, 4, 5]))",
"assert is_same_list(candidate(h... | newfacade/LeetCodeDataset | {
"constraints": [
"assert is_same_list(candidate(head=list_node([9999, 9998, 9997, 9996, 9995, 9994, 9993, 9992, 9991, 9990])), list_node([9990, 9991, 9992, 9993, 9994, 9995, 9996, 9997, 9998, 9999]))",
"assert is_same_list(candidate(head=list_node([1, 2, 3, 4, 5])), list_node([1, 2, 3, 4, 5]))",
"assert... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven the head of a linked list, return the list after sorting it in ascen... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given the head of a linked list, return the list after sorting it in ascending order.
Constraints:
The number of nod... | [
"assert is_same_list(candidate(head=list_node([50000, -50000, 100000, -100000, 150000, -150000, 200000, -200000, 250000, -250000, 300000, -300000])), list_node([-300000, -250000, -200000, -150000, -100000, -50000, 50000, 100000, 150000, 200000, 250000, 300000]))",
"assert is_same_list(candidate(head=list_node([-1... | newfacade/LeetCodeDataset | {
"constraints": [
"assert is_same_list(candidate(head=list_node([50000, -50000, 100000, -100000, 150000, -150000, 200000, -200000, 250000, -250000, 300000, -300000])), list_node([-300000, -250000, -200000, -150000, -100000, -50000, 50000, 100000, 150000, 200000, 250000, 300000]))",
"assert is_same_list(candi... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an array of strings tokens that represents an arithmetic exp... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an array of strings tokens that represents an arithmetic expression in a Reverse Polish Notation.
Evaluat... | [
"assert candidate(tokens=['1', '2', '3', '+', '*']) == 5",
"assert candidate(tokens=['10', '20', '5', '/', '2', '*']) == 10",
"assert candidate(tokens=['10', '5', '-', '3', '*', '4', '+', '2', '/']) == 9",
"assert candidate(tokens=['2', '3', '4', '5', '+', '*', '6', '/']) == 2",
"assert candidate(tokens=['1... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(tokens=['1', '2', '3', '+', '*']) == 5",
"assert candidate(tokens=['10', '20', '5', '/', '2', '*']) == 10",
"assert candidate(tokens=['10', '5', '-', '3', '*', '4', '+', '2', '/']) == 9",
"assert candidate(tokens=['2', '3', '4', '5', '+', '*', '6', '/']) == 2",
... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nSuppose an array of length n sorted in ascending order is rotated between ... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Suppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = ... | [
"assert candidate(nums=[2, 1, 3]) == 2",
"assert candidate(nums=[2, 3, 4, 5, 6, 7, 8, 9, 1, 0]) == 1",
"assert candidate(nums=[1, -5000, -4999, -4998, -4997, -4996, -4995, -4994, -4993, -4992, -4991]) == -5000",
"assert candidate(nums=[3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[2, 1, 3]) == 2",
"assert candidate(nums=[2, 3, 4, 5, 6, 7, 8, 9, 1, 0]) == 1",
"assert candidate(nums=[1, -5000, -4999, -4998, -4997, -4996, -4995, -4994, -4993, -4992, -4991]) == -5000",
"assert candidate(nums=[3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27,... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nSuppose an array of length n sorted in ascending order is rotated between ... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Suppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = ... | [
"assert candidate(nums=[7, 8, 9, 10, 0, 1, 2, 3, 4, 5, 6]) == 0",
"assert candidate(nums=[5, 6, 7, 0, 1, 2, 3]) == 0",
"assert candidate(nums=[2, 3, 4, 5, 1]) == 1",
"assert candidate(nums=[1, 1, 1, 1, 0, 0, 1]) == 0",
"assert candidate(nums=[15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 0... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[7, 8, 9, 10, 0, 1, 2, 3, 4, 5, 6]) == 0",
"assert candidate(nums=[5, 6, 7, 0, 1, 2, 3]) == 0",
"assert candidate(nums=[2, 3, 4, 5, 1]) == 1",
"assert candidate(nums=[1, 1, 1, 1, 0, 0, 1]) == 0",
"assert candidate(nums=[15, 16, 17, 18, 19, 20, 21, 22, 23, ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven a string s, return the length of the longest substring that contains... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given a string s, return the length of the longest substring that contains at most two distinct characters.
Constrain... | [
"assert candidate(s='aabbaaabbbaaaabbbaaabbbaabbbaaaabbbaaabbbaabbbaaaaabbbaaaaabbbaaaa') == 66",
"assert candidate(s='abcabcabcabc') == 2",
"assert candidate(s='abacabac') == 3",
"assert candidate(s='zxyzzxyzzxyzzxyzz') == 3",
"assert candidate(s='aabbaabbaabbaabb') == 16",
"assert candidate(s='ababababa... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='aabbaaabbbaaaabbbaaabbbaabbbaaaabbbaaabbbaabbbaaaaabbbaaaaabbbaaaa') == 66",
"assert candidate(s='abcabcabcabc') == 2",
"assert candidate(s='abacabac') == 3",
"assert candidate(s='zxyzzxyzzxyzzxyzz') == 3",
"assert candidate(s='aabbaabbaabbaabb') == 16",
... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven two strings s and t, return true if they are both one edit distance ... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given two strings s and t, return true if they are both one edit distance apart, otherwise return false.
A string s is ... | [
"assert candidate(s='abcdefghij', t='abcdefghijab') == False",
"assert candidate(s='a', t='b') == True",
"assert candidate(s='12345', t='123456') == True",
"assert candidate(s='gumbo', t='gambol') == False",
"assert candidate(s='abcd', t='dcba') == False",
"assert candidate(s='abcdefghijk', t='abchijk') =... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='abcdefghij', t='abcdefghijab') == False",
"assert candidate(s='a', t='b') == True",
"assert candidate(s='12345', t='123456') == True",
"assert candidate(s='gumbo', t='gambol') == False",
"assert candidate(s='abcd', t='dcba') == False",
"assert candidate(... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an integer array nums, return the maximum difference between two suc... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given an integer array nums, return the maximum difference between two successive elements in its sorted form. If the a... | [
"assert candidate(nums=[20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1",
"assert candidate(nums=[1, 10, 100, 1000, 10000, 100000]) == 90000",
"assert candidate(nums=[1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97]) == 4",
"assert c... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1",
"assert candidate(nums=[1, 10, 100, 1000, 10000, 100000]) == 90000",
"assert candidate(nums=[1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven two version strings, version1 and version2, compare them. A version ... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given two version strings, version1 and version2, compare them. A version string consists of revisions separated by dot... | [
"assert candidate(version1='0.0.0.0.0.1', version2='0.0.0.0.0.0') == 1",
"assert candidate(version1='1.000000000.000000000', version2='1.0') == 0",
"assert candidate(version1='1.000000001', version2='1.1') == 0",
"assert candidate(version1='001.002.003', version2='1.2.3') == 0",
"assert candidate(version1='... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(version1='0.0.0.0.0.1', version2='0.0.0.0.0.0') == 1",
"assert candidate(version1='1.000000000.000000000', version2='1.0') == 0",
"assert candidate(version1='1.000000001', version2='1.1') == 0",
"assert candidate(version1='001.002.003', version2='1.2.3') == 0",
... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an integer n, return the number of trailing zeroes in n!.\nNote that... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given an integer n, return the number of trailing zeroes in n!.
Note that n! = n * (n - 1) * (n - 2) * ... * 3 * 2 * 1.... | [
"assert candidate(n=50000) == 12499",
"assert candidate(n=1250) == 312",
"assert candidate(n=49) == 10",
"assert candidate(n=2500) == 624",
"assert candidate(n=20) == 4",
"assert candidate(n=15) == 3",
"assert candidate(n=99999) == 24994",
"assert candidate(n=14) == 2",
"assert candidate(n=7812) == ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(n=50000) == 12499",
"assert candidate(n=1250) == 312",
"assert candidate(n=49) == 10",
"assert candidate(n=2500) == 624",
"assert candidate(n=20) == 4",
"assert candidate(n=15) == 3",
"assert candidate(n=99999) == 24994",
"assert candidate(n=14) == ... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven a list of non-negative integers nums, arrange them such that they fo... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given a list of non-negative integers nums, arrange them such that they form the largest number and return it.
Since th... | [
"assert candidate(nums=[1111, 111, 11, 1]) == '1111111111'",
"assert candidate(nums=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == '9876543210'",
"assert candidate(nums=[10, 100, 1000, 10000, 100000]) == '10100100010000100000'",
"assert candidate(nums=[67, 676, 6767, 67676, 676767, 6767676]) == '6767676767676767676676766... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1111, 111, 11, 1]) == '1111111111'",
"assert candidate(nums=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) == '9876543210'",
"assert candidate(nums=[10, 100, 1000, 10000, 100000]) == '10100100010000100000'",
"assert candidate(nums=[67, 676, 6767, 67676, 676767, 6767676]) ==... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nThe DNA sequence is composed of a series of nucleotides abbreviated as 'A'... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
The DNA sequence is composed of a series of nucleotides abbreviated as 'A', 'C', 'G', and 'T'.
For example, "ACGAATTCC... | [
"assert candidate(s='ATATATATATATATATATATATATATATATATATATATATATATATATATATATATATATAT') == ['ATATATATAT', 'TATATATATA']",
"assert candidate(s='AAGGTTCCGGTTCCTTAAAGGTTCCGGTTCCT') == ['AAGGTTCCGG', 'AGGTTCCGGT', 'GGTTCCGGTT', 'GTTCCGGTTC', 'TTCCGGTTCC', 'TCCGGTTCCT']",
"assert candidate(s='TTTACCGGAAAACCGGAAAACCGGA... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(s='ATATATATATATATATATATATATATATATATATATATATATATATATATATATATATATAT') == ['ATATATATAT', 'TATATATATA']",
"assert candidate(s='AAGGTTCCGGTTCCTTAAAGGTTCCGGTTCCT') == ['AAGGTTCCGG', 'AGGTTCCGGT', 'GGTTCCGGTT', 'GTTCCGGTTC', 'TTCCGGTTCC', 'TCCGGTTCCT']",
"assert candidate(s='... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are given an integer array prices where prices[i] is the price of a gi... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are given an integer array prices where prices[i] is the price of a given stock on the ith day, and an integer k.
F... | [
"assert candidate(k=100, prices=[10, 22, 5, 75, 65, 80]) == 97",
"assert candidate(k=0, prices=[7, 6, 4, 3, 1]) == 0",
"assert candidate(k=2, prices=[10, 22, 5, 75, 65, 80]) == 87",
"assert candidate(k=10, prices=[8, 9, 8, 10, 9, 10, 9, 10, 9, 10, 9, 10, 9, 10, 9]) == 8",
"assert candidate(k=10, prices=[2, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(k=100, prices=[10, 22, 5, 75, 65, 80]) == 97",
"assert candidate(k=0, prices=[7, 6, 4, 3, 1]) == 0",
"assert candidate(k=2, prices=[10, 22, 5, 75, 65, 80]) == 87",
"assert candidate(k=10, prices=[8, 9, 8, 10, 9, 10, 9, 10, 9, 10, 9, 10, 9, 10, 9]) == 8",
"asser... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an integer array nums, rotate the array to the right by k steps, whe... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given an integer array nums, rotate the array to the right by k steps, where k is non-negative.
Constraints:
1 <= nu... | [
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], k=10) == None",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30], k=0) == None",
"assert candidate(nums=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], k=10) == None",
"assert candidate(nums=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30], k=0) == None",
"assert candidate(nums=[0, 1, 2, 3, 4, 5, 6,... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nYou are a professional robber planning to rob houses along a street. Each ... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, ... | [
"assert candidate(nums=[10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 300",
"assert candidate(nums=[10, 20, 30, 40, 50]) == 90",
"assert candidate(nums=[5, 10, 5, 10]) == 20",
"assert candidate(nums=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 10",
"assert candidate(nums=[100, 200, 300, 4... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(nums=[10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) == 300",
"assert candidate(nums=[10, 20, 30, 40, 50]) == 90",
"assert candidate(nums=[5, 10, 5, 10]) == 20",
"assert candidate(nums=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 10",
"assert can... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven the root of a binary tree, imagine yourself standing on the right si... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given the root of a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you ... | [
"assert candidate(root=tree_node([1, 2, None, 3, 4, None, None, 5, 6])) == [1, 2, 4, 6]",
"assert candidate(root=tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, None, None, 14, 15])) == [1, 3, 7, 13, 15]",
"assert candidate(root=tree_node([1, None, 2, 3, None, 4, None, 5, None, 6, None, 7, None, 8, None, ... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(root=tree_node([1, 2, None, 3, 4, None, None, 5, 6])) == [1, 2, 4, 6]",
"assert candidate(root=tree_node([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, None, None, 14, 15])) == [1, 3, 7, 13, 15]",
"assert candidate(root=tree_node([1, None, 2, 3, None, 4, None, 5, None, 6,... |
[
{
"role": "user",
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n### Question:\nGiven an m x n 2D binary grid grid which represents a map of '1's (land) a... | You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.
### Question:
Given an m x n 2D binary grid grid which represents a map of '1's (land) and '0's (water), return the number of islands... | [
"assert candidate(grid=[['1', '1', '1', '0', '0', '0', '1', '0', '0', '0', '1'], ['1', '0', '1', '0', '1', '0', '1', '0', '1', '1', '0'], ['0', '1', '1', '0', '1', '1', '0', '0', '0', '1', '1'], ['0', '0', '0', '1', '0', '1', '0', '1', '0', '1', '1'], ['1', '1', '0', '0', '1', '1', '0', '0', '1', '0', '1'], ['0', '... | newfacade/LeetCodeDataset | {
"constraints": [
"assert candidate(grid=[['1', '1', '1', '0', '0', '0', '1', '0', '0', '0', '1'], ['1', '0', '1', '0', '1', '0', '1', '0', '1', '1', '0'], ['0', '1', '1', '0', '1', '1', '0', '0', '0', '1', '1'], ['0', '0', '0', '1', '0', '1', '0', '1', '0', '1', '1'], ['1', '1', '0', '0', '1', '1', '0', '0', '1... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.