task_id stringlengths 5 7 | question stringlengths 192 1.48k | test_list listlengths 2 5 | test_function stringlengths 54 236 | entry_point stringclasses 1
value | test_matching stringlengths 57 291 | test_match_function stringclasses 1
value |
|---|---|---|---|---|---|---|
OOP/101 | Question: Given an integer array **nums**, determine whether there exists a length-3 increasing subsequence in this array. If there exists such a triplet index (i, j, k) and satisfies i < j < k, such that nums[i] < nums[j] < nums[k], return True; otherwise, return False.
Please use Python language to first design a **L... | [
"assert candidate([1,2,3,4,5])==True",
"assert candidate([5,4,3,2,1])==False",
"assert candidate([2,1,5,0,4,6])==True"
] | def test_run(content1):
return LSU(content1).public_Longest_subsequence() | test_run | assert candidate([['class LSU', 'def _private_Longest_subsequence', 'def public_Longest_subsequence'], ['class LSU', 'def __private_Longest_subsequence', 'def public_Longest_subsequence']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/102 | Firstly, design a class **CVA** using the Python language, which has an instance attribute **distance**, a private function **private_Counterclockwise_variation**, and a public function **public_Counterclockwise_variation**. Then, implement the following problem in the private function **private_Counterclockwise_variat... | [
"assert candidate([2,1,1,2])==True",
"assert candidate([1,2,3,4])==False",
"assert candidate([1,1,1,1])==True"
] | def test_run(content1):
return CVA(content1).public_Counterclockwise_variation() | test_run | assert candidate([['class CVA', 'def _private_Counterclockwise_variation', 'def public_Counterclockwise_variation'], ['class CVA', 'def __private_Counterclockwise_variation', 'def public_Counterclockwise_variation']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/103 | Firstly, design a **USI** class using Python language, which has an instance attribute **words**, a private function **private_Unique_String**, and a public function **public_Unique_String**. Then, in the private function **private_Unique_String**, return an array of strings from **words** that satisfy the palindrome p... | [
"assert candidate([\"abcd\",\"dcba\",\"lls\",\"s\",\"sssll\"])==[[0,1],[1,0],[3,2],[2,4]]",
"assert candidate([\"bat\",\"tab\",\"cat\"])==[[0,1],[1,0]]",
"assert candidate([\"a\",\"\"])==[[0,1],[1,0]]"
] | def test_run(content1):
return USI(content1).public_Unique_String() | test_run | assert candidate([['class USI', 'def _private_Unique_String', 'def public_Unique_String'], ['class USI', 'def __private_Unique_String', 'def public_Unique_String']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/104 | Firstly, design a **PMM** class using Python language, which has an instance attribute **n**, a private function **private_Product_maximization**, and a public function **public_Product_maximization**. Then, in the private function **private_Product_maximization**, decompose the positive integer **n** into the sum of *... | [
"assert candidate(2)==1",
"assert candidate(10)==36"
] | def test_run(content1):
return PMM(content1).public_Product_maximization() | test_run | assert candidate([['class PMM', 'def _private_Product_maximization', 'def public_Product_maximization'], ['class PMM', 'def __private_Product_maximization', 'def public_Product_maximization']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/105 | Firstly, design an **RSI** class using Python language, which has an instance attribute **s**, a private function **private_Result_String**, and a public function **public_Result_String**. Then, in the private function **private_Result_String**, reverse all the vowel letters in the string **s** and return the result st... | [
"assert candidate(\"hello\")==\"holle\"",
"assert candidate(\"leetcode\")==\"leotcede\""
] | def test_run(content1):
return RSI(content1).public_Result_String() | test_run | assert candidate([['class RSI', 'def _private_Result_String', 'def public_Result_String'], ['class RSI', 'def __private_Result_String', 'def public_Result_String']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/106 | Firstly, design an **AOER** class using Python language, which has instance attributes **nums** and **k**, a private function **private_Any_order**, and a public function **public_Any_order**. Then, in the private function **private_Any_order**, return the top k most frequent elements in the integer array **nums**. Fin... | [
"assert candidate([1,1,1,2,2,3],2)==[1,2]",
"assert candidate([1],1)==[1]"
] | def test_run(content1,content2):
return AOER(content1,content2).public_Any_order() | test_run | assert candidate([['class AOER', 'def _private_Any_order', 'def public_Any_order'], ['class AOER', 'def __private_Any_order', 'def public_Any_order']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/107 | First, design a **TIE** class using the Python language, which has instance attributes **nums1** and **nums2**, a private function **private_Their_intersection**, and a public function **public_Their_intersection**. Then, in the private function **private_Their_intersection**, return the intersection between the arrays... | [
"assert candidate([1,2,2,1],[2,2])==[2]",
"assert candidate([4,9,5],[9,4,9,8,4])==[9,4]"
] | def test_run(content1,content2):
return TIE(content1,content2).public_Their_intersection() | test_run | assert candidate([['class TIE', 'def _private_Their_intersection', 'def public_Their_intersection'], ['class TIE', 'def __private_Their_intersection', 'def public_Their_intersection']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/108 | Question: Given two integer arrays **nums1** and **nums2**, please return the intersection of the two arrays in the form of an array. The number of times each element appears in the return result should be consistent with the number of times the element appears in both arrays (if the number of appearances is inconsiste... | [
"assert candidate([1,2,2,1],[2,2])==[2,2]",
"assert candidate([4,9,5],[9,4,9,8,4])==[4,9]"
] | def test_run(content1,content2):
return ORU(content1,content2).public_Order_results() | test_run | assert candidate([['class ORU', 'def _private_Order_results', 'def public_Order_results'], ['class ORU', 'def __private_Order_results', 'def public_Order_results']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/109 | Firstly, design an **RDL** class using the Python language, which has an instance attribute **envelopes**, a private function **private_Russian_dolls**, and a public function **public_Russian_dolls**. Then, implement the following problem in the private function **private_Russian_dolls**. Finally, call the private func... | [
"assert candidate([[5,4],[6,4],[6,7],[2,3]])==3",
"assert candidate([[1,1],[1,1],[1,1]])==1"
] | def test_run(content1):
return RDL(content1).public_Russian_dolls() | test_run | assert candidate([['class RDL', 'def _private_Russian_dolls', 'def public_Russian_dolls'], ['class RDL', 'def __private_Russian_dolls', 'def public_Russian_dolls']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/110 | Firstly, design an **NDE** class using Python language, which has an instance attribute **n**, a private function **private_Numbers_different**, and a public function **public_Numbers_different**. Then, implement the following problem in the private function **private_Numbers_different**. Finally, call the private func... | [
"assert candidate(2)==91",
"assert candidate(0)==1"
] | def test_run(content1):
return NDE(content1).public_Numbers_different() | test_run | assert candidate([['class NDE', 'def _private_Numbers_different', 'def public_Numbers_different'], ['class NDE', 'def __private_Numbers_different', 'def public_Numbers_different']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/111 | Firstly, design a class named **MVL** using Python language, which has instance attributes **matrix** and **k**, a private function **private_Maximum_value**, and a public function **public_Maximum_value**. Then, in the private function **private_Maximum_value**, return the maximum sum of values within the rectangular ... | [
"assert candidate([[1,0,1],[0,-2,3]],2)==2",
"assert candidate([[2,2,-1]],3)==3"
] | def test_run(content1,content2):
return MVL(content1,content2).public_Maximum_value() | test_run | assert candidate([['class MVL', 'def _private_Maximum_value', 'def public_Maximum_value'], ['class MVL', 'def __private_Maximum_value', 'def public_Maximum_value']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/112 | Firstly, design a **DSS** class using Python language, which has an instance attribute **nums**, a private function **private_Divisible_subset**, and a public function **public_Divisible_subset**. Then, in the private function **private_Divisible_subset**, given a set **nums** composed of non-repetitive positive intege... | [
"assert candidate([1,2,3])==[1,2]",
"assert candidate([1,2,4,8])==[1,2,4,8]"
] | def test_run(content1):
return DSS(content1).public_Divisible_subset() | test_run | assert candidate([['class DSS', 'def _private_Divisible_subset', 'def public_Divisible_subset'], ['class DSS', 'def __private_Divisible_subset', 'def public_Divisible_subset']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/113 | Question: Calculate **a^b mod 1337**, where **a** is a positive integer and **b** is a very large positive integer given in the form of an array.
Use Python language to first design a **PIT** class, with instance attributes **a** and **b**, a private function **private_positive_integer**, and a public function **public... | [
"assert candidate(2,[3])==8",
"assert candidate(2,[1,0])==1024",
"assert candidate(1,[4,3,3,8,5,2])==1",
"assert candidate(2147483647,[2,0,0])==1198"
] | def test_run(content1,content2):
return PIT(content1,content2).public_positive_integer() | test_run | assert candidate([['class PIT', 'def _private_positive_integer', 'def public_positive_integer'], ['class PIT', 'def __private_positive_integer', 'def public_positive_integer']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/114 | Question: Given two integer arrays **nums1** and **nums2** sorted in non-decreasing order, and an integer **k**. Define a pair of values (u, v), where the first element comes from **nums1** and the second element comes from **nums2**. Please find the pairs with the smallest sum (u1, v1), (u2, v2)...(uk, vk) for the fir... | [
"assert candidate([1,7,11],[2,4,6],3)==[1,2],[1,4],[1,6]",
"assert candidate([1,1,2],[1,2,3],2)==[1,1],[1,1]",
"assert candidate([1,2],[3],3)==[1,3],[2,3]"
] | def test_run(content1,content2,content3):
return DAG(content1,content2,content3).public_decreasing_arrangement() | test_run | assert candidate([['class DAG', 'def _private_decreasing_arrangement', 'def public_decreasing_arrangement'], ['class DAG', 'def __private_decreasing_arrangement', 'def public_decreasing_arrangement']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/115 | First, design an **NBGG** class using the Python language, which has an instance attribute **n**, a private function **private_Guessing_Game**, and a public function **public_Guessing_Game**. Then, call the private function **private_ugly_number** in the public function **public_Guessing_Game** to return the result. Th... | [
"assert candidate(10)==16",
"assert candidate(1)==0",
"assert candidate(2)==1"
] | def test_run(content1):
return NBGG(content1).public_Guessing_Game() | test_run | assert candidate([['class NBGG', 'def _private_Guessing_Game', 'def public_Guessing_Game'], ['class NBGG', 'def __private_Guessing_Game', 'def public_Guessing_Game']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/116 | Firstly, design an **LSS** class using Python language, which has an instance attribute **nums**, a private function **private_Longest_subsequence**, and a public function **public_Longest_subsequence**. Then, in the private function **private_Longest_subsequence**, return the length of the longest subsequence in the i... | [
"assert candidate([1,7,4,9,2,5])==6",
"assert candidate([1,17,5,10,13,15,10,5,16,8])==7",
"assert candidate([1,2,3,4,5,6,7,8,9])==2"
] | def test_run(content1):
return LSS(content1).public_Longest_subsequence() | test_run | assert candidate([['class LSS', 'def _private_Longest_subsequence', 'def public_Longest_subsequence'], ['class LSS', 'def __private_Longest_subsequence', 'def public_Longest_subsequence']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/117 | Question: Given an array **nums** composed of distinct integers and a target integer **target**, please find and return the number of combinations in **nums** that sum up to **target**.
Please use Python language to first design an **EAC** class, with instance attributes **nums** and **target**, a private function **p... | [
"assert candidate([1,2,3],4)==7",
"assert candidate([9],3)==0"
] | def test_run(content1,content2):
return EAC(content1,content2).public_element_association() | test_run | assert candidate([['class EAC', 'def _private_element_association', 'def public_element_association'], ['class EAC', 'def __private_element_association', 'def public_element_association']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/118 | Question: Given an n x n matrix **matrix**, where each row and column elements are sorted in ascending order, find the k-th smallest element in the matrix.
Please use Python to first design a **SAS** class, with instance attributes **matrix** and **k**, a private function **private_Sort_ascending**, and a public functi... | [
"assert candidate([[1,5,9],[10,11,13],[12,13,15]],8)==13",
"assert candidate([[-5]],1)==-5"
] | def test_run(content1,content2):
return SAS(content1,content2).public_Sort_ascending() | test_run | assert candidate([['class SAS', 'def _private_Sort_ascending', 'def public_Sort_ascending'], ['class SAS', 'def __private_Sort_ascending', 'def public_Sort_ascending']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/119 | Question: Given a string **s** representing a **NestedInteger** of integers, implement a parser to parse it and return the parsed result as **NestedInteger**.
Please use Python to first design an **INT** class, which has an instance attribute **s**, a private function **private_Integer_nesting**, and a public function... | [
"assert candidate(\"324\")==324",
"assert candidate(\"[123,[456,[789]]]\")==[123,[456,[789]]]"
] | def test_run(content1):
return INT(content1).public_Integer_nesting() | test_run | assert candidate([['class INT', 'def _private_Integer_nesting', 'def public_Integer_nesting'], ['class INT', 'def _private_Integer_nesting', 'def public_Integer_nesting']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/120 | Firstly, design a class named **DOD** using Python language, which has an instance attribute **n**, a private function **private_Dictionary_order**, and a public function **public_Dictionary_order**. Then, in the private function **private_Dictionary_order**, return all integers within the range [1, n] in dictionary or... | [
"assert candidate(13)==[1,10,11,12,13,2,3,4,5,6,7,8,9]",
"assert candidate(2)==[1,2]"
] | def test_run(content1):
return DOD(content1).public_Dictionary_order() | test_run | assert candidate([['class DOD', 'def _private_Dictionary_order', 'def public_Dictionary_order'], ['class DOD', 'def __private_Dictionary_order', 'def public_Dictionary_order']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/121 | Question: Given two strings **s** and **t**, they only contain lowercase letters. String **t** is randomly rearranged from string **s**, and then a letter is added at a random position. Please find the letter added in **t**.
Please use Python language to first design a **RAI** class, with instance attributes **s** and ... | [
"assert candidate(\"abcd\",\"abcde\")==\"e\"",
"assert candidate(\"\",\"y\")==\"y\""
] | def test_run(content1,content2):
return RAI(content1,content2).public_Random_addition() | test_run | assert candidate([['class RAI', 'def _private_Random_addition', 'def public_Random_addition'], ['class RAI', 'def __private_Random_addition', 'def public_Random_addition']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/122 | Firstly, design an **RNE** class using Python language, which has an instance attribute **n**, a private function **private_remaining_numbers**, and a public function **public_remaining_numbers**. Then, implement the following problem in the private function **private_remaining_numbers**. Finally, call the private func... | [
"assert candidate(9)==6",
"assert candidate(1)==1"
] | def test_run(content1):
return RNE(content1).public_remaining_numbers() | test_run | assert candidate([['class RNE', 'def _private_remaining_numbers', 'def public_remaining_numbers'], ['class RNE', 'def __private_remaining_numbers', 'def public_remaining_numbers']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/123 | Firstly, design a **PCN** class using Python language, which has an instance attribute **rectangles**, a private function **private_Parallel_coordinate**, and a public function **public_Parallel_coordinate**. Then, implement the following problem in the private function **private_Parallel_coordinate**. Finally, call th... | [
"assert candidate([[1,1,3,3],[3,1,4,2],[3,2,4,4],[1,3,2,4],[2,3,3,4]])==True",
"assert candidate([[1,1,2,3],[1,3,2,4],[3,1,4,2],[3,2,4,4]])==False",
"assert candidate([[1,1,3,3],[3,1,4,2],[1,3,2,4],[2,2,4,4]])==False"
] | def test_run(content1):
return PCN(content1).public_Parallel_coordinate() | test_run | assert candidate([['class PCN', 'def _private_Parallel_coordinate', 'def public_Parallel_coordinate'], ['class PCN', 'def __private_Parallel_coordinate', 'def public_Parallel_coordinate']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/124 | Firstly, design a **VED** class using Python language, which has an instance attribute **data**, a private function **private_Valid_encoding**, and a public function **public_Valid_encoding**. Then, implement the following problem in the private function **private_Valid_encoding**. Finally, call the private function **... | [
"assert candidate([197,130,1])==True",
"assert candidate([235,140,4])==False"
] | def test_run(content1):
return VED(content1).public_Valid_encoding() | test_run | assert candidate([['class VED', 'def _private_Valid_encoding', 'def public_Valid_encoding'], ['class VED', 'def __private_Valid_encoding', 'def public_Valid_encoding']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/125 | Firstly, design a class **LST** using the Python language, which has instance attributes **s** and **k**, a private function **private_Longest_substring**, and a public function **public_Longest_substring**. Then, in the private function **private_Longest_substring**, return the length of the longest substring in the s... | [
"assert candidate(\"aaabb\",3)==3",
"assert candidate(\"ababbc\",2)==5"
] | def test_run(content1,content2):
return LST(content1,content2).public_Longest_substring() | test_run | assert candidate([['class LST', 'def _private_Longest_substring', 'def public_Longest_substring'], ['class LST', 'def __private_Longest_substring', 'def public_Longest_substring']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/126 | Firstly, design a **CRT** class using Python language, which has an instance attribute **nums**, a private function **private_clockwise_rotation**, and a public function **public_clockwise_rotation**. Then, implement the following problem in the private function **private_clockwise_rotation**. Finally, call the private... | [
"assert candidate([4,3,2,6])==26",
"assert candidate([100])==0"
] | def test_run(content1):
return CRT(content1).public_clockwise_rotation() | test_run | assert candidate([['class CRT', 'def _private_clockwise_rotation', 'def public_clockwise_rotation'], ['class CRT', 'def __private_clockwise_rotation', 'def public_clockwise_rotation']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/127 | Firstly, design an **MRC** class using Python language, which has an instance attribute **n**, a private function **private_Minimum_replacements**, and a public function **public_Minimum_replacements**. Then, in the private function **private_Minimum_replacements**, given a positive integer **n**, if **n** is even, rep... | [
"assert candidate(8)==3",
"assert candidate(7)==4",
"assert candidate(4)==2"
] | def test_run(content1):
return MRC(content1).public_Minimum_replacements() | test_run | assert candidate([['class MRC', 'def _private_Minimum_replacements', 'def public_Minimum_replacements'], ['class MRC', 'def __private_Minimum_replacements', 'def public_Minimum_replacements']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/128 | Firstly, design an **IIG** class using Python language, which has an instance attribute **n**, a private function **private_Infinite_integers**, and a public function **public_Infinite_integers**. Then, in the private function **private_Infinite_integers**, return the number at the n-th position in the infinite integer... | [
"assert candidate(3)==3",
"assert candidate(11)==0"
] | def test_run(content1):
return IIG(content1).public_Infinite_integers() | test_run | assert candidate([['class IIG', 'def _private_Infinite_integers', 'def public_Infinite_integers'], ['class IIG', 'def __private_Infinite_integers', 'def public_Infinite_integers']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/129 | Question: Given a non-negative integer **num** represented as a string and an integer **k**, remove **k** digits from the number so that the remaining number is the smallest. Please return this smallest number in string form.
Using Python, first design a **SNU** class, which has instance attributes **num** and **k**, a... | [
"assert candidate(\"1432219\",3)==\"1219\"",
"assert candidate(\"10200\",1)==\"200\"",
"assert candidate(\"10\",2)==\"0\""
] | def test_run(content1,content2):
return SNU(content1,content2).public_smallest_number() | test_run | assert candidate([['class SNU', 'def _private_smallest_number', 'def public_smallest_number'], ['class SNU', 'def __private_smallest_number', 'def public_smallest_number']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/130 | First, design an **RQU** class using the Python language, which has an instance attribute **people**, a private function **private_Rank_queue**, and a public function **public_Rank_queue**. Then, implement the following problem in the private function **private_Rank_queue**. Finally, call the private function **private... | [
"assert candidate([[7,0],[4,4],[7,1],[5,0],[6,1],[5,2]])==[[5,0],[7,0],[5,2],[6,1],[4,4],[7,1]]",
"assert candidate([[6,0],[5,0],[4,0],[3,2],[2,2],[1,4]])==[[4,0],[5,0],[2,2],[3,2],[1,4],[6,0]]"
] | def test_run(content1):
return RQU(content1).public_Rank_queue() | test_run | assert candidate([['class RQU', 'def _private_Rank_queue', 'def public_Rank_queue'], ['class RQU', 'def __private_Rank_queue', 'def public_Rank_queue']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/131 | Question: Given a non-negative integer array **nums** and an integer **m**, you need to divide this array into **m** non-empty continuous subarrays. Design an algorithm to make the maximum value of the sum of these **m** subarrays the smallest.
Please use Python language to first design a **CSR** class, with instance a... | [
"assert candidate([7,2,5,10,8],2)==18",
"assert candidate([1,2,3,4,5],2)==9",
"assert candidate([1,4,4],3)==4"
] | def test_run(content1,content2):
return CSR(content1,content2).public_Continuous_subarray() | test_run | assert candidate([['class CSR', 'def _private_Continuous_subarray', 'def public_Continuous_subarray'], ['class CSR', 'def __private_Continuous_subarray', 'def public_Continuous_subarray']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/132 | Firstly, design an **EAY** class using the Python language, which has an instance attribute **nums**, a private function **private_Equidistant_array**, and a public function **public_Equidistant_array**. Then, in the private function **private_Equidistant_array**, provide an integer array **nums** and return the number... | [
"assert candidate([1,2,3,4])==3",
"assert candidate([1])==0"
] | def test_run(content1):
return EAY(content1).public_Equidistant_array() | test_run | assert candidate([['class EAY', 'def _private_Equidistant_array', 'def public_Equidistant_array'], ['class EAY', 'def __private_Equidistant_array', 'def public_Equidistant_array']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/133 | Firstly, design an **SSB** class using the Python language, which has an instance attribute **nums**, a private function **private_split_subset**, and a public function **public_split_subset**. Then, in the private function **private_split_subset**, determine whether the non-empty array **nums**, which only contains po... | [
"assert candidate([1,5,11,5])==True",
"assert candidate([1,2,3,5])==False"
] | def test_run(content1):
return SSB(content1).public_split_subset() | test_run | assert candidate([['class SSB', 'def _private_split_subset', 'def public_split_subset'], ['class SSB', 'def __private_split_subset', 'def public_split_subset']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/134 | Question: Given a m x n matrix **board** representing a deck, where each cell can be a battleship 'X' or an empty spot '.', return the number of battleships placed on the board.
Please use Python to first design a **PBI** class, with an instance attribute **board**, a private function **private_Placed_battleships**, an... | [
"assert candidate([[\"X\",\".\",\".\",\"X\"],[\".\",\".\",\".\",\"X\"],[\".\",\".\",\".\",\"X\"]])==2",
"assert candidate([[\".\"]])==0"
] | def test_run(content1):
return PBI(content1).","() | test_run | assert candidate([['class PBI', 'def _private_Placed_battleships', 'def public_Placed_battleships'], ['class PBI', 'def __private_Placed_battleships', 'def public_Placed_battleships']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/135 | First, design an **MRU** class using the Python language, which has an instance attribute **nums**, a private function **private_Maximum_result**, and a public function **public_Maximum_result**. Then, in the private function **private_Maximum_result**, return the maximum operation result of nums[i] XOR nums[j], where ... | [
"assert candidate([3,10,5,25,2,8])==28",
"assert candidate([14,70,53,83,49,91,36,80,92,51,66,70])==127"
] | def test_run(content1):
return MRU(content1).public_Maximum_result() | test_run | assert candidate([['class MRU', 'def _private_Maximum_result', 'def public_Maximum_result'], ['class MRU', 'def __private_Maximum_result', 'def public_Maximum_result']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/136 | Question: Given a string **s**, which contains several numbers (0-9) represented by scrambled English words, return the original numbers in ascending order.
Using Python language, first design a **DOR** class, with instance attribute **s**, private function **private_Disordered_order** and public function **public_Diso... | [
"assert candidate(\"owoztneoer\")==\"012\"",
"assert candidate(\"fviefuro\")==\"45\""
] | def test_run(content1):
return DOR(content1).public_Disordered_order() | test_run | assert candidate([['class DOR', 'def _private_Disordered_order', 'def public_Disordered_order'], ['class DOR', 'def __private_Disordered_order', 'def public_Disordered_order']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/137 | Firstly, design an **LSR** class using Python language, which has instance attributes **s** and **k**, a private function **private_Longest_substring**, and a public function **public_Longest_substring**. Then, in the private function **private_Longest_substring**, change any character in the string **s** to any other ... | [
"assert candidate(\"ABAB\",2)==4",
"assert candidate(\"AABABBA\",1)==4"
] | def test_run(content1,content2):
return LSR(content1,content2).public_Longest_substring() | test_run | assert candidate([['class LSR', 'def _private_Longest_substring', 'def public_Longest_substring'], ['class LSR', 'def _private_Longest_substring', 'def public_Longest_substring']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/138 | Firstly, design a class **GS** using Python language, which has instance attributes **start**, **end**, and **bank**, a private function **private_gene_sequence**, and a public function **public_gene_sequence**. Then, implement the following problem in the private function **private_gene_sequence**. Finally, call the p... | [
"assert candidate(\"AACCGGTT\", \"AACCGGTA\", [\"AACCGGTA\"])==1",
"assert candidate(\"AACCGGTT\", \"AAACGGTA\", [\"AACCGGTA\",\"AACCGCTA\",\"AAACGGTA\"])==2",
"assert candidate(\"AAAAACCC\", \"AACCCCCC\", [\"AAAACCCC\",\"AAACCCCC\",\"AACCCCCC\"])==3"
] | def test_run(content1,content2,content3):
return GS(content1,content2,content3).public_gene_sequence() | test_run | assert candidate([['class GS', 'def _private_gene_sequence', 'def public_gene_sequence'], ['class GS', 'def __private_gene_sequence', 'def public_gene_sequence']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/139 | Question: Given a collection of **intervals** where intervals[i] = [start_i, end_i]. Return the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping.
Please use Python to first design a **SIL** class, with instance attribute **intervals**, a private function **private_Set_int... | [
"assert candidate([[1,2],[2,3],[3,4],[1,3]])==1",
"assert candidate([[1,2], [1,2], [1,2]])==2",
"assert candidate([[1,2], [2,3]])==0"
] | def test_run(content1):
return SIL(content1).public_Set_intervals() | test_run | assert candidate([['class SIL', 'def _private_Set_intervals', 'def public_Set_intervals'], ['class SIL', 'def __private_Set_intervals', 'def public_Set_intervals']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/140 | Firstly, design an **RSC** class using Python language, which has an instance attribute **intervals**, a private function **private_Right_section**, and a public function **public_Right_section**. Then, implement the following problem in the private function **private_Right_section**. Finally, call the private function... | [
"assert candidate([[1,2]])==[-1]",
"assert candidate([[3,4],[2,3],[1,2]])==[-1,0,1]",
"assert candidate([[1,4],[2,3],[3,4]])==[-1,2,-1]"
] | def test_run(content1):
return RSC(content1).public_Right_section() | test_run | assert candidate([['class RSC', 'def _private_Right_section', 'def public_Right_section'], ['class RSC', 'def __private_Right_section', 'def public_Right_section']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/141 | Question: Given two strings **s** and **p**, find all the anagrams of **p** in **s**, and return the starting indices of these substrings. An anagram is a string formed by rearranging the same letters (including the same string).
Please use Python to first design a **SIN** class, with instance attributes **s** and **p*... | [
"assert candidate(\"cbaebabacd\",\"abc\")==[0,6]",
"assert candidate(\"abab\",\"ab\")==[0,1,2]"
] | def test_run(content1,content2):
return SIN(content1,content2).public_start_index() | test_run | assert candidate([['class SIN', 'def _private_start_index', 'def public_start_index'], ['class SIN', 'def __private_start_index', 'def public_start_index']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/142 | Firstly, design a **DOE** class using Python language, which has instance attributes **n** and **k**, a private function **private_Dictionary_order**, and a public function **public_Dictionary_order**. Then, return the **k-th** smallest number in the dictionary order of [1, n] in the private function **private_Dictiona... | [
"assert candidate(13,2)==10",
"assert candidate(1,1)==1"
] | def test_run(content1,content2):
return DOE(content1,content2).public_Dictionary_order() | test_run | assert candidate([['class DOE', 'def _private_Dictionary_order', 'def public_Dictionary_order'], ['class DOE', 'def __private_Dictionary_order', 'def public_Dictionary_order']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/143 | Question: There are a total of **n** coins, and the plan is to arrange them in a staircase shape. For a staircase composed of **k** rows, the i-th row must have exactly **i** coins. The last row of the staircase may be incomplete. Given a number **n**, calculate and return the total number of rows that can form a compl... | [
"assert candidate(5)==2",
"assert candidate(8)==3"
] | def test_run(content1):
return CLA(content1).public_Complete_ladder() | test_run | assert candidate([['class CLA', 'def _private_Complete_ladder', 'def public_Complete_ladder'], ['class CLA', 'def __private_Complete_ladder', 'def public_Complete_ladder']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/144 | Question: Given an integer array **nums** of length **n**, where all integers in **nums** are within the range [1, n] and each integer appears once or twice. Please find all integers that appear twice and return them in the form of an array.
Please use Python to first design a class **AFO** with instance attribute **nu... | [
"assert candidate([4,3,2,7,8,2,3,1])==[2,3]",
"assert candidate([1,1,2])==[1]",
"assert candidate([1])==[]"
] | def test_run(content1):
return AFO(content1).public_Array_form() | test_run | assert candidate([['class AFO', 'def _private_Array_form', 'def public_Array_form'], ['class AFO', 'def __private_Array_form', 'def public_Array_form']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/145 | Firstly, design an **ISAR** class using the Python language, which has instance attributes **chars**, a private function **private_Input_sarray**, and a public function **public_Input_sarray**. Then, implement the following problem in the private function **private_Input_sarray**. Finally, call the private function **p... | [
"assert candidate([\"a\",\"a\",\"b\",\"b\",\"c\",\"c\",\"c\"])==[\"a\",\"2\",\"b\",\"2\",\"c\",\"3\"]",
"assert candidate([\"a\"])==[\"a\"]",
"assert candidate([\"a\",\"b\",\"b\",\"b\",\"b\",\"b\",\"b\",\"b\",\"b\",\"b\",\"b\",\"b\",\"b\"])==[\"a\",\"b\",\"1\",\"2\"]"
] | def test_run(content1):
return ISAR(content1).public_Input_sarray() | test_run | assert candidate([['class ISAR', 'def _private_Input_sarray', 'def public_Input_sarray'], ['class ISAR', 'def __private_Input_sarray', 'def public_Input_sarray']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/146 | Firstly, design an **ESQ** class using Python language, which has an instance attribute **nums**, a private function **private_Equidistant_subsequence**, and a public function **public_Equidistant_subsequence**. Then, in the private function **private_Equidistant_subsequence**, return the number of all equidistant subs... | [
"assert candidate([2,4,6,8,10])==7",
"assert candidate([7,7,7,7,7])==16"
] | def test_run(content1):
return ESQ(content1).public_Equidistant_subsequence() | test_run | assert candidate([['class ESQ', 'def _private_Equidistant_subsequence', 'def public_Equidistant_subsequence'], ['class ESQ', 'def __private_Equidistant_subsequence', 'def public_Equidistant_subsequence']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/147 | Firstly, design an **EDA** class using Python language, which has an instance attribute **points**, a private function **private_Euclidean_distance**, and a public function **public_Euclidean_distance**. Then, implement the following problem in the private function **private_Euclidean_distance**. Finally, call the priv... | [
"assert candidate([[0,0],[1,0],[2,0]])==2",
"assert candidate([[1,1],[2,2],[3,3]])==2",
"assert candidate([[1,1]])==0"
] | def test_run(content1):
return EDA(content1).public_Euclidean_distance() | test_run | assert candidate([['class EDA', 'def _private_Euclidean_distance', 'def public_Euclidean_distance'], ['class EDA', 'def __private_Euclidean_distance', 'def public_Euclidean_distance']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/148 | Question: Given a string **s**, sort it in decreasing order based on the frequency of characters. The frequency of a character is the number of times it appears in the string. Return the sorted string.
Please use Python to first design a **DODE** class, with an instance attribute **s**, a private function **private_des... | [
"assert candidate(\"tree\")==\"eert\"",
"assert candidate(\"cccaaa\")==\"cccaaa\"",
"assert candidate(\"Aabb\")==\"bbAa\""
] | def test_run(content1):
return DODE(content1).public_descending_order() | test_run | assert candidate([['class DODE', 'def _private_descending_order', 'def public_descending_order'], ['class DODE', 'def __private_descending_order', 'def public_descending_order']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/149 | Question: Given an integer array of length n, each operation will increase n - 1 elements by 1. Return the minimum number of operations to make all elements in the array equal.
Please design an **EEL** class in Python first, with instance attribute **nums**, a private function **private_Element_equality**, and a public... | [
"assert candidate([1,2,3])==3",
"assert candidate([1,1,1])==0"
] | def test_run(content1):
return EEL(content1).public_Element_equality() | test_run | assert candidate([['class EEL', 'def _private_Element_equality', 'def public_Element_equality'], ['class EEL', 'def __private_Element_equality', 'def public_Element_equality']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/150 | Question: Given four integer arrays **nums1**, **nums2**, **nums3**, and **nums4**, all of the same length **n**, calculate how many tuples (i, j, k, l) can satisfy: 0 <= i, j, k, l < n and nums1[i] + nums2[j] + nums3[k] + nums4[l] == 0.
Please use Python to first design an **AST** class, with instance attributes **num... | [
"assert candidate([1,2],[-2,-1],[-1,2],[0,2])==2",
"assert candidate([0],[0],[0],[0])==1"
] | def test_run(content1,content2,content3,content4):
return AST(content1,content2,content3,content4).public_Array_stlength() | test_run | assert candidate([['class AST', 'def _private_Array_stlength', 'def public_Array_stlength'], ['class AST', 'def __private_Array_stlength', 'def public_Array_stlength']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/151 | Question: Given an integer array **nums** with **n** integers. A 132 pattern subsequence is a three-element sequence nums[i], nums[j], and nums[k] that satisfies: i<j<k and nums[i]<nums[k]<nums[j]. If there is a 132 pattern subsequence in **nums**, return True; otherwise, return False.
Please design a **SPAR** class in... | [
"assert candidate([1,2,3,4])==False",
"assert candidate([3,1,4,2])==True",
"assert candidate([-1,3,2,0])==True"
] | def test_run(content1):
return SPAR(content1).public_Subsequences_patterns() | test_run | assert candidate([['class SPAR', 'def _private_Subsequences_patterns', 'def public_Subsequences_patterns'], ['class SPAR', 'def __private_Subsequences_patterns', 'def public_Subsequences_patterns']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/152 | Firstly, design an **SPR** class using Python language, which has an instance attribute **nums**, a private function **private_Suences_patterns**, and a public function **public_Suences_patterns**. Then, implement the following problem in the private function **private_Suences_patterns**. Finally, call the private func... | [
"assert candidate([2,-1,1,2,2])==True",
"assert candidate([-1,2])==False",
"assert candidate([-2,1,-1,-2,-2])==False"
] | def test_run(content1):
return SPR(content1).public_Suences_patterns() | test_run | assert candidate([['class SPR', 'def _private_Suences_patterns', 'def public_Suences_patterns'], ['class SPR', 'def __private_Suences_patterns', 'def public_Suences_patterns']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/153 | Question: Given an integer array **nums** of length **n**, return the minimum number of operations required to make all elements of the array equal. In one operation, you can increase or decrease an element of the array by one.
Please use Python to first design an **OOA** class, with instance attribute **nums**, a priv... | [
"assert candidate([1,2,3])==2",
"assert candidate([1,10,2,9])==16"
] | def test_run(content1):
return OOA(content1).public_One_operation() | test_run | assert candidate([['class OOA', 'def _private_One_operation', 'def public_One_operation'], ['class OOA', 'def __private_One_operation', 'def public_One_operation']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/154 | Firstly, design a class **PIGE** using Python language, which has instance attributes **maxChoosableInteger** and **desiredTotal**, a private function **private_Public_integer**, and a public function **public_Public_integer**. Then, implement the following problem in the private function **private_Public_integer**. Fi... | [
"assert candidate(10,11)==False",
"assert candidate(10,0)==True",
"assert candidate(10,1)==True"
] | def test_run(content1,content2):
return PIGE(content1,content2).public_Public_integer() | test_run | assert candidate([['class PIGE', 'def _private_Public_integer', 'def public_Public_integer'], ['class PIGE', 'def __private_Public_integer', 'def public_Public_integer']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/155 | Firstly, design an **IIFI** class using Python language, which has instance attributes **s1**, **n1**, **s2**, and **n2**, a private function **private_Italic_tion**, and a public function **public_Italic_tion**. Then, implement the following problem in the private function **private_Italic_tion**. Finally, call the pr... | [
"assert candidate(\"acb\",4,\"ab\",2)==2",
"assert candidate(\"acb\",1,\"acb\",1)==1"
] | def test_run(content1,content2,content3,content4):
return IIFI(content1,content2,content3,content4).public_Italic_tion() | test_run | assert candidate([['class IIFI', 'def _private_Italic_tion', 'def public_Italic_tion'], ['class IIFI', 'def __private_Italic_tion', 'def public_Italic_tion']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/156 | Question: Define a string base as an infinitely wrapped "abcdefghijklmnopqrstuvwxyz", so the base looks like this: "...zabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd....". Given a string s, please count and return how many different non-empty substrings appear in the base.
Please use Python to first design a... | [
"assert candidate(\"a\")==1",
"assert candidate(\"cac\")==2",
"assert candidate(\"zab\")==6"
] | def test_run(content1):
return IZOE(content1).public_Infinity_Zone() | test_run | assert candidate([['class IZOE', 'def _private_Infinity_Zone', 'def public_Infinity_Zone'], ['class IZOE', 'def __private_Infinity_Zone', 'def public_Infinity_Zone']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/157 | Firstly, design an **EDC** class using Python language, which has an instance attribute **words**, a private function **private_Excluding_Duplicates**, and a public function **public_Excluding_Duplicates**. Then, in the private function **private_Excluding_Duplicates**, provide a string array **words** that does not co... | [
"assert candidate([\"cat\",\"cats\",\"catsdogcats\",\"dog\",\"dogcatsdog\",\"hippopotamuses\",\"rat\",\"ratcatdogcat\"])==[\"catsdogcats\",\"dogcatsdog\",\"ratcatdogcat\"]",
"assert candidate([\"cat\",\"dog\",\"catdog\"])==[\"catdog\"]"
] | def test_run(content1):
return EDC(content1).public_Excluding_Duplicates() | test_run | assert candidate([['class EDC', 'def _private_Excluding_Duplicates', 'def public_Excluding_Duplicates'], ['class EDC', 'def __private_Excluding_Duplicates', 'def public_Excluding_Duplicates']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/158 | Firstly, design an **EMSP** class using Python language, which has an instance attribute **matchsticks**, a private function **private_Each_matchstick**, and a public function **public_Each_matchstick**. Then, implement the following problem in the private function **private_Each_matchstick**. Finally, call the private... | [
"assert candidate([1,1,2,2,2])==True",
"assert candidate([3,3,3,3,4])==False"
] | def test_run(content1):
return EMSP(content1).public_Each_matchstick() | test_run | assert candidate([['class EMSP', 'def _private_Each_matchstick', 'def public_Each_matchstick'], ['class EMSP', 'def __private_Each_matchstick', 'def public_Each_matchstick']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/159 | Question: Given a binary string array **strs** and two integers **m** and **n**. Please find and return the length of the maximum subset of **strs**, which has at most **m** zeros and **n** ones. If all elements of **x** are also elements of **y**, set **x** is a subset of set **y**.
Please use Python language to first... | [
"assert candidate([\"10\", \"0001\", \"111001\", \"1\", \"0\"],5,3)==4",
"assert candidate([\"10\", \"0\", \"1\"],1,1)==2"
] | def test_run(content1,content2,content3):
return MSBS(content1,content2,content3).public_Maximum_subset() | test_run | assert candidate([['class MSBS', 'def _private_Maximum_subset', 'def public_Maximum_subset'], ['class MSBS', 'def __private_Maximum_subset', 'def public_Maximum_subset']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/160 | Firstly, design a class named **ANUB** using Python language, which has an instance attribute **nums**, a private function **private_Any_numbers**, and a public function **public_Any_numbers**. Then, in the private function **private_Any_numbers**, return the total Hamming distance between any two numbers in the intege... | [
"assert candidate([4,14,2])==6",
"assert candidate([4,14,4])==4"
] | def test_run(content1):
return ANUB(content1).public_Any_numbers() | test_run | assert candidate([['class ANUB', 'def _private_Any_numbers', 'def public_Any_numbers'], ['class ANUB', 'def __private_Any_numbers', 'def public_Any_numbers']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/161 | Firstly, design an **MPRD** class using the Python language, which has an instance attribute **n**, a private function **private_Maximum_palindrome**, and a public function **public_Maximum_palindrome**. Then, in the private function **private_Maximum_palindrome**, return the maximum palindrome integer that can be repr... | [
"assert candidate(2)==987",
"assert candidate(1)==9"
] | def test_run(content1):
return MPRD(content1).public_Maximum_palindrome() | test_run | assert candidate([['class MPRD', 'def _private_Maximum_palindrome', 'def public_Maximum_palindrome'], ['class MPRD', 'def __private_Maximum_palindrome', 'def public_Maximum_palindrome']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/162 | Firstly, design an **MSRI** class using the Python language, which has an instance attribute **n**, a private function **private_Magic_String**, and a public function **public_Magic_String**. Then, implement the following problem in the private function **private_Magic_String**. Finally, call the private function **pri... | [
"assert candidate(6)==3",
"assert candidate(1)==1"
] | def test_run(content1):
return MSRI(content1).public_Magic_String() | test_run | assert candidate([['class MSRI', 'def _private_Magic_String', 'def public_Magic_String'], ['class MSRI', 'def __private_Magic_String', 'def public_Magic_String']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/163 | Firstly, design an **MBS** class using the Python language, which has an instance attribute **n**, a private function **private_Minimum_base**, and a public function **public_Minimum_base**. Then, in the private function **private_Minimum_base**, it is required to return the minimum good base of **n** in the form of a ... | [
"assert candidate(\"13\")==\"3\"",
"assert candidate(\"4681\")==\"8\"",
"assert candidate(\"1000000000000000000\")==\"999999999999999999\""
] | def test_run(content1):
return MBS(content1).public_Minimum_base() | test_run | assert candidate([['class MBS', 'def _private_Minimum_base', 'def public_Minimum_base'], ['class MBS', 'def __private_Minimum_base', 'def public_Minimum_base']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/164 | Question: Given an integer array **nums**, find and return all the distinct increasing sub-sequences in this array, where each sub-sequence must contain at least two elements.
Please design an **ISQE** class in Python, which has an instance attribute **nums**, a private function **private_increasing_subsequence**, and ... | [
"assert candidate([4,6,7,7])==[[4,6],[4,6,7],[4,6,7,7],[4,7],[4,7,7],[6,7],[6,7,7],[7,7]]",
"assert candidate([4,4,3,2,1])==[[4,4]]"
] | def test_run(content1):
return ISQE(content1).public_increasing_subsequence() | test_run | assert candidate([['class ISQE', 'def _private_increasing_subsequence', 'def public_increasing_subsequence'], ['class ISQE', 'def __private_increasing_subsequence', 'def public_increasing_subsequence']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/165 | Question: Given an array **nums**, if i<j and nums[i]>2*nums[j], we call (i, j) an important reverse pair. You need to return the number of **important reverse pairs** in the given array.
Please use Python to first design an **IFIP** class, with instance attribute **nums**, private function **private_Important_flipping... | [
"assert candidate([1,3,2,3,1])==2",
"assert candidate([2,4,3,5,1])==3"
] | def test_run(content1):
return IFIP(content1).public_Important_flipping() | test_run | assert candidate([['class IFIP', 'def _private_Important_flipping', 'def public_Important_flipping'], ['class IFIP', 'def __private_Important_flipping', 'def public_Important_flipping']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/166 | Question: Given a non-negative integer array **nums** and an integer **target**. By adding '+' or '-' in front of each integer in the array and then concatenating all the integers, an expression can be constructed. Return the number of different expressions that can be constructed in the above way and the calculation r... | [
"assert candidate([1,1,1,1,1],3)==5",
"assert candidate([1],1)==1"
] | def test_run(content1,content2):
return DESI(content1,content2).public_Different_expressions() | test_run | assert candidate([['class DESI', 'def _private_Different_expressions', 'def public_Different_expressions'], ['class DESI', 'def __private_Different_expressions', 'def public_Different_expressions']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/167 | Firstly, design a **DTVL** class using Python language, which has an instance attribute **mat**, a private function **private_Diagonal_traversal**, and a public function **public_Diagonal_traversal**. Then, in the private function **private_Diagonal_traversal**, return all the elements in the m x n matrix **mat** in th... | [
"assert candidate([[1,2,3],[4,5,6],[7,8,9]])==[1,2,4,7,5,3,6,8,9]",
"assert candidate([[1,2],[3,4]])==[1,2,3,4]"
] | def test_run(content1):
return DTVL(content1).public_Diagonal_traversal() | test_run | assert candidate([['class DTVL', 'def _private_Diagonal_traversal', 'def public_Diagonal_traversal'], ['class DTVL', 'def __private_Diagonal_traversal', 'def public_Diagonal_traversal']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/168 | Question: Given a circular array **nums** (the next element of nums[nums.length-1] is nums[0]), return the next greater element for each element in **nums**. The next greater element of a number **x** is the first number that is larger than it following the array traversal order, which means you should search for its n... | [
"assert candidate([1,2,1])==[2,-1,2]",
"assert candidate([1,2,3,4,3])==[2,3,4,-1,4]"
] | def test_run(content1):
return ATSA(content1).public_Array_traversal() | test_run | assert candidate([['class ATSA', 'def _private_Array_traversal', 'def public_Array_traversal'], ['class ATSA', 'def __private_Array_traversal', 'def public_Array_traversal']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/169 | Firstly, design an **RL** class using the Python language, which has an instance attribute **s**, a private function **private_Return_length**, and a public function **public_Return_length**. Then, in the private function **private_Return_length**, return the length of the longest palindromic subsequence in the string ... | [
"assert candidate(\"bbbab\")==4",
"assert candidate(\"cbbd\")==2"
] | def test_run(content1):
return RL(content1).public_Return_length() | test_run | assert candidate([['class RL', 'def _private_Return_length', 'def public_Return_length'], ['class RL', 'def __private_Return_length', 'def public_Return_length']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/170 | First, design an **NCC** class using the Python language, which has instance attributes **amount** and **coins**, a private function **coin_combinations**, and a public function **public_combinations**. Then, in the private function **coin_combinations**, return the number of coin combinations that can make up the tota... | [
"assert candidate([1, 2, 5])==4",
"assert candidate([2])==0",
"assert candidate([10])==1"
] | def test_run(content1):
return NCC(content1).public_combinations() | test_run | assert candidate([['class NCC', 'def _coin_combinations', 'def public_combinations'], ['class NCC', 'def __coin_combinations', 'def public_combinations']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/171 | Firstly, design an **ML** class using Python language, which has an instance attribute **strs**, a private function **private_Maximum_length**, and a public function **public_Maximum_length**. Then, in the private function **private_Maximum_length**, return the length of the longest special sequence in the string list ... | [
"assert candidate([\"aba\",\"cdc\",\"eae\"])==3",
"assert candidate([\"aaa\",\"aaa\",\"aa\"])==-1"
] | def test_run(content1):
return ML(content1).public_Maximum_length() | test_run | assert candidate([['class ML', 'def _private_Maximum_length', 'def public_Maximum_length'], ['class ML', 'def __private_Maximum_length', 'def public_Maximum_length']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/172 | First, design an **LS** class using the Python language, which has instance attributes **s** and **dictionary**, a private function **private_Longest_string**, and a public function **public_Longest_string**. Then, in the private function **private_Longest_string**, return the longest string in the **dictionary**, whic... | [
"assert candidate(\"abpcplea\",[\"ale\",\"apple\",\"monkey\",\"plea\"])==\"apple\"",
"assert candidate(\"abpcplea\",[\"a\",\"b\",\"c\"])==\"a\""
] | def test_run(content1,content2):
return LS(content1,content2).public_Longest_string() | test_run | assert candidate([['class LS', 'def _private_Longest_string', 'def public_Longest_string'], ['class LS', 'def __private_Longest_string', 'def public_Longest_string']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/173 | Firstly, design an **AL** class using Python language, which has an instance attribute **nums**, a private function **private_Array_length**, and a public function **public_Array_length**. Then, find the longest consecutive subarray with the same number of 0 and 1 in the private function **private_Array_length**, and r... | [
"assert candidate([0,1])==2",
"assert candidate([0,1,0])==2"
] | def test_run(content1):
return AL(content1).public_Array_length() | test_run | assert candidate([['class AL', 'def _private_Array_length', 'def public_Array_length'], ['class AL', 'def __private_Array_length', 'def public_Array_length']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/174 | Firstly, design a class **CQ** using the Python language, which has an instance attribute **n**, a private function **private_Construction_quantity**, and a public function **public_Construction_quantity**. Then, in the private function **private_Construction_quantity**, return the number of beautiful arrangements that... | [
"assert candidate(2)==2",
"assert candidate(1)==1"
] | def test_run(content1):
return CQ(content1).public_Construction_quantity() | test_run | assert candidate([['class CQ', 'def _private_Construction_quantity', 'def public_Construction_quantity'], ['class CQ', 'def __private_Construction_quantity', 'def public_Construction_quantity']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/175 | Firstly, design an **RS** class using the Python language, which has an instance attribute **w**, a private function **private_Return_Subscript**, and a public function **public_Return_Subscript**. Then, in the private function **private_Return_Subscript**, randomly select and return a subscript from the range [0, w.le... | [
"assert candidate([\"Solution\",\"pickIndex\"],[[[1]],[]])==[null,0]",
"assert candidate([\"Solution\",\"pickIndex\",\"pickIndex\",\"pickIndex\",\"pickIndex\",\"pickIndex\"],[[[1,3]],[],[],[],[],[]])==[null,1,1,1,1,0]"
] | def test_run(content1,content2):
return RS(content1,content2).public_Return_Subscript() | test_run | assert candidate([['class RS', 'def _private_Return_Subscript', 'def public_Return_Subscript'], ['class RS', 'def __private_Return_Subscript', 'def public_Return_Subscript']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/176 | Firstly, design a class named **MG** using Python language, which has instance attributes **board** and **click**, a private function **private_Minesweeping_game**, and a public function **public_Minesweeping_game**. Then, implement the following problem in the private function **private_Minesweeping_game**. Finally, c... | [
"assert candidate([[\"E\",\"E\",\"E\",\"E\",\"E\"],[\"E\",\"E\",\"M\",\"E\",\"E\"],[\"E\",\"E\",\"E\",\"E\",\"E\"],[\"E\",\"E\",\"E\",\"E\",\"E\"]],[3,0])==[[\"B\",\"1\",\"E\",\"1\",\"B\"],[\"B\",\"1\",\"M\",\"1\",\"B\"],[\"B\",\"1\",\"1\",\"1\",\"B\"],[\"B\",\"B\",\"B\",\"B\",\"B\"]]",
"assert candidate([[\"B\",... | def test_run(content1,content2):
return MG(content1,content2).public_Minesweeping_game() | test_run | assert candidate([['class MG', 'def _private_Minesweeping_game', 'def public_Minesweeping_game'], ['class MG', 'def __private_Minesweeping_game', 'def public_Minesweeping_game']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/177 | Firstly, design a class **NP** using the Python language, which has instance attributes **nums** and **k**, a private function **private_Number_Pairs**, and a public function **public_Number_Pairs**. Then, return the number of different **k-diff** number pairs in the private function **private_Number_Pairs**. Finally, ... | [
"assert candidate([3, 1, 4, 1, 5],2)==2",
"assert candidate([1, 2, 3, 4, 5],1)==4",
"assert candidate([1, 3, 1, 5, 4],0)==1"
] | def test_run(content1,content2):
return NP(content1,content2).public_Number_Pairs() | test_run | assert candidate([['class NP', 'def _private_Number_Pairs', 'def public_Number_Pairs'], ['class NP', 'def __private_Number_Pairs', 'def public_Number_Pairs']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/178 | Firstly, design a **SOP** class using the Python language, which has instance attributes **num1** and **num2**, a private function **String_product**, and a public function **public_String_product**. Then, in the private function **String_product**, follow the complex number representation format, and return a string r... | [
"assert candidate(\"1+1i\",\"1+1i\")==\"0+2i\"",
"assert candidate(\"1+-1i\",\"1+-1i\")==\"0+-2i\""
] | def test_run(content1,content2):
return SOP(content1,content2).public_String_product() | test_run | assert candidate([['class SOP', 'def _String_product', 'def public_String_product'], ['class SOP', 'def __String_product', 'def public_String_product']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/179 | Firstly, design an **MTD** class using the Python language, which has an instance attribute **timePoints**, a private function **Minimum_difference**, and a public function **public_Minimum_difference**. Then, in the private function **Minimum_difference**, return the minimum time difference between any two times in th... | [
"assert candidate([\"23:59\",\"00:00\"])==1",
"assert candidate([\"00:00\",\"23:59\",\"00:00\"])==0"
] | def test_run(content1):
return MTD(content1).public_Number_occurrences() | test_run | assert candidate([['class MTD', 'def _Minimum_difference', 'def public_Minimum_difference'], ['class MTD', 'def __Minimum_difference', 'def public_Minimum_difference']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/180 | Firstly, design a class named **NOO** using Python language, which has an instance attribute **nums**, a private function **Number_occurrences**, and a public function **public_Number_occurrences**. Then, implement the following problem in the private function **Number_occurrences**. Finally, call the private function ... | [
"assert candidate([1,1,2,3,3,4,4,8,8])==2",
"assert candidate([3,3,7,7,10,11,11])==10"
] | def test_run(content1):
return NOO(content1).public_Number_of_occurrences() | test_run | assert candidate([['class NOO', 'def _Number_occurrences', 'def public_Number_occurrences'], ['class NOO', 'def __Number_occurrences', 'def public_Number_occurrences']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/181 | Firstly, design a class named **MS** using Python language, which has an instance attribute **mat**, a private function **private_Matrices_size**, and a public function **public_Matrices_size**. Then, implement the following problem in the private function **private_Matrices_size**. Finally, call the private function *... | [
"assert candidate([[0,0,0],[0,1,0],[0,0,0]])==[[0,0,0],[0,1,0],[0,0,0]]",
"assert candidate([[0,0,0],[0,1,0],[1,1,1]])==[[0,0,0],[0,1,0],[1,2,1]]"
] | def test_run(content1):
return MS(content1).public_Matrices_size() | test_run | assert candidate([['class MS', 'def _private_Matrices_size', 'def public_Matrices_size'], ['class MS', 'def __private_Matrices_size', 'def public_Matrices_size']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/182 | Firstly, design an **RB** class using Python language, which has an instance attribute **boxes**, a private function **private_Remove_Box**, and a public function **public_Remove_Box**. Then, implement the following problem in the private function **private_Remove_Box**. Finally, call the private function **private_Rem... | [
"assert candidate([1,3,2,2,2,3,4,3,1])==23",
"assert candidate([1,1,1])==9",
"assert candidate([1])==1"
] | def test_run(content1):
return RB(content1).public_Remove_Box() | test_run | assert candidate([['class RB', 'def _private_Remove_Box', 'def public_Remove_Box'], ['class RB', 'def __private_Remove_Box', 'def public_Remove_Box']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/183 | Firstly, design an **AP** class using the Python language, which has an instance attribute **nums**, a private function **private_Add_parentheses**, and a public function **public_Add_parentheses**. Then, implement the following problem in the private function **private_Add_parentheses**. Finally, call the private func... | [
"assert candidate([1000,100,10,2])==\"1000/(100/10/2)\"",
"assert candidate([2,3,4])==\"2/(3/4)\""
] | def test_run(content1):
return AP(content1).public_Add_parentheses() | test_run | assert candidate([['class AP', 'def _private_Add_parentheses', 'def public_Add_parentheses'], ['class AP', 'def __private_Add_parentheses', 'def public_Add_parentheses']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/184 | Firstly, design an **MI** class using Python language, which has an instance attribute **n**, a private function **private_Minimum_integer**, and a public function **public_Minimum_integer**. Then, implement the following problem in the private function **private_Minimum_integer**. Finally, call the private function **... | [
"assert candidate(12)==21",
"assert candidate(21)==-1"
] | def test_run(content1):
return MI(content1).public_Minimum_integer() | test_run | assert candidate([['class MI', 'def _private_Minimum_integer', 'def public_Minimum_integer'], ['class MI', 'def __private_Minimum_integer', 'def public_Minimum_integer']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/185 | Firstly, design an **IS** class using the Python language, which has an instance attribute **s**, a private function **private_Invert_String**, and a public function **public_Invert_String**. Then, in the private function **private_Invert_String**, output the string after reversing the character order of each word in t... | [
"assert candidate(\"Let's take LeetCode contest\")==\"s'teL ekat edoCteeL tsetnoc\"",
"assert candidate(\"God Ding\")==\"doG gniD\""
] | def test_run(content1):
return IS(content1).public_Invert_String() | test_run | assert candidate([['class IS', 'def _private_Invert_String', 'def public_Invert_String'], ['class IS', 'def __private_Invert_String', 'def public_Invert_String']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/186 | Firstly, design a **CS** class using Python language, which has instance attributes **nums** and **k**, a private function **private_Continuous_subarray**, and a public function **public_Continuous_subarray**. Then, in the private function **private_Continuous_subarray**, count and return the number of continuous subar... | [
"assert candidate([1,1,1],2)==2",
"assert candidate([1,2,3],3)==2"
] | def test_run(content1,content2):
return CS(content1,content2).public_Continuous_subarray() | test_run | assert candidate([['class CS', 'def _private_Continuous_subarray', 'def public_Continuous_subarray'], ['class CS', 'def __private_Continuous_subarray', 'def public_Continuous_subarray']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/187 | Firstly, design a class **PI** using the Python language, which has an instance attribute **n**, a private function **private_Palindrome_integer**, and a public function **public_Palindrome_integer**. Then, in the private function **private_Palindrome_integer**, return the palindrome integer closest to the string **n**... | [
"assert candidate(\"123\")==\"121\"",
"assert candidate(\"1\")==\"0\""
] | def test_run(content1):
return PI(content1).public_Palindrome_integer() | test_run | assert candidate([['class PI', 'def _private_Palindrome_integer', 'def public_Palindrome_integer'], ['class PI', 'def __private_Palindrome_integer', 'def public_Palindrome_integer']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/188 | Firstly, design a class **JA** using the Python language, which has instance attributes **s1** and **s2**, a private function **private_Judgment_arrangement**, and a public function **public_Judgment_arrangement**. Then, in the private function **private_Judgment_arrangement**, determine whether **s2** contains the arr... | [
"assert candidate(\"ab\",\"eidbaooo\")==True",
"assert candidate(\"ab\",\"eidboaoo\")==False"
] | def test_run(content1,content2):
return JA(content1,content2).public_Judgment_arrangement() | test_run | assert candidate([['class JA', 'def _private_Judgment_arrangement', 'def public_Judgment_arrangement'], ['class JA', 'def __private_Judgment_arrangement', 'def public_Judgment_arrangement']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/189 | Firstly, design a class named **SS** using the Python language, which includes an instance attribute **nums**, a private function **private_Shortest_subarray**, and a public function **public_Shortest_subarray**. Then, implement the following problem in the private function **private_Shortest_subarray**. Finally, call ... | [
"assert candidate([2,6,4,8,10,9,15])==5",
"assert candidate([1,2,3,4])==0",
"assert candidate([1])==0"
] | def test_run(content1):
return SS(content1).public_Shortest_subarray() | test_run | assert candidate([['class SS', 'def _private_Shortest_subarray', 'def public_Shortest_subarray'], ['class SS', 'def __private_Shortest_subarray', 'def public_Shortest_subarray']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/190 | Firstly, design a class named **MS** using the Python language, which has instance attributes **word1** and **word2**, a private function **private_Minimum_Steps**, and a public function **public_Minimum_Steps**. Then, in the private function **private_Minimum_Steps**, return the minimum number of steps required to mak... | [
"assert candidate(\"sea\",\"eat\")==2",
"assert candidate(\"leetcode\",\"etco\")==4"
] | def test_run(content1,content2):
return MS(content1,content2).public_Minimum_Steps() | test_run | assert candidate([['class MS', 'def _private_Minimum_Steps', 'def public_Minimum_Steps'], ['class MS', 'def __private_Minimum_Steps', 'def public_Minimum_Steps']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/191 | Firstly, design an **RC** class using the Python language, which has an instance attribute **trees**, a private function **private_Return_Coordinates**, and a public function **public_Return_Coordinates**. Then, implement the following problem in the private function **private_Return_Coordinates**. Finally, call the pr... | [
"assert candidate([[1,1],[2,2],[2,0],[2,4],[3,3],[4,2]])==[[1,1],[2,0],[3,3],[2,4],[4,2]]",
"assert candidate([[1,2],[2,2],[4,2]])==[[4,2],[2,2],[1,2]]"
] | def test_run(content1):
return RC(content1).public_Return_Coordinates() | test_run | assert candidate([['class RC', 'def _private_Return_Coordinates', 'def public_Return_Coordinates'], ['class RC', 'def __private_Return_Coordinates', 'def public_Return_Coordinates']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/192 | First, design a class named **MS** using Python language, which has an instance attribute **expression**, a private function **private_Minimal_Score**, and a public function **public_Minimal_Score**. Then, implement the following problem in the private function **private_Minimal_Score**. Finally, call the private funct... | [
"assert candidate(\"-1/2+1/2\")==\"0/1\"",
"assert candidate(\"-1/2+1/2\")==\"0/1\"",
"assert candidate(\"1/3-1/2\")==\"-1/6\""
] | def test_run(content1):
return MS(content1).public_Minimal_Score() | test_run | assert candidate([['class MS', 'def _private_Minimal_Score', 'def public_Minimal_Score'], ['class MS', 'def __private_Minimal_Score', 'def public_Minimal_Score']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/193 | Firstly, design a **FAS** class using the Python language, which has instance attributes **p1**, **p2**, **p3**, and **p4**, a private function **Form_square**, and a public function **public_Form_square**. Then, in the private function **Form_square**, determine whether the four points form a square. If they do, retur... | [
"assert candidate([0,0],[1,1],[1,0],[0,1])==True",
"assert candidate([0,0],[1,1],[1,0],[0,12])==False",
"assert candidate([1,0],[-1,0],[0,1],[0,-1])==False"
] | def test_run(content1,content2,content3,content4):
return FAS(content1,content2,content3,content4).public_Form_square() | test_run | assert candidate([['class FAS', 'def _Form_square', 'def public_Form_a_square'], ['class FAS', 'def __Form_square', 'def public_Form_a_square']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/194 | Firstly, design a **TC** class using Python language, which has an instance attribute **n**, a private function **private_There_continuity**, and a public function **public_There_continuity**. Then, in the private function **private_There_continuity**, count how many non-negative integers in the range of [0, n] do not ... | [
"assert candidate(5)==5",
"assert candidate(1)==2",
"assert candidate(2)==3"
] | def test_run(content1):
return TC(content1).public_There_continuity() | test_run | assert candidate([['class TC', 'def _private_There_continuity', 'def public_There_continuity'], ['class TC', 'def __private_There_continuity', 'def public_There_continuity']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/195 | Firstly, design a **NOT** class using Python language, which has an instance attribute **nums**, a private function **private_Number_of_triples**, and a public function **public_Number_of_triples**. Then, in the private function **private_Number_of_triples**, return the number of triples that **nums** can form the thre... | [
"assert candidate([2,2,3,4])==3",
"assert candidate([4,2,3,4])==4"
] | def test_run(content1):
return NOT(content1).public_Number_of_triples() | test_run | assert candidate([['class NOT', 'def _private_Number_of_triples', 'def public_Number_of_triples'], ['class NOT', 'def __private_Number_of_triples', 'def public_Number_of_triples']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/196 | Firstly, design an **MT** class using Python language, which has instance attributes **tasks** and **n**, a private function **private_Minimum_time**, and a public function **public_Minimum_time**. Then, implement the following problem in the private function **private_Minimum_time**. Finally, call the private function... | [
"assert candidate([\"A\",\"A\",\"A\",\"B\",\"B\",\"B\"],2)==8",
"assert candidate([\"A\",\"A\",\"A\",\"B\",\"B\",\"B\"],0)==6",
"assert candidate([\"A\",\"A\",\"A\",\"A\",\"A\",\"A\",\"B\",\"C\",\"D\",\"E\",\"F\",\"G\"],2)==16"
] | def test_run(content1,content2):
return MT(content1,content2).public_Minimum_time() | test_run | assert candidate([['class MT', 'def _private_Minimum_time', 'def public_Minimum_time'], ['class MT', 'def __private_Minimum_time', 'def public_Minimum_time']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/197 | Firstly, design a class named **ROP** using the Python language, which has instance attributes **n** and **k**, a private function **private_Reverse_order_pair**, and a public function **public_Reverse_order_pair**. Then, implement the following problem in the private function **private_Reverse_order_pair**. Finally, c... | [
"assert candidate(3,0)==1",
"assert candidate(3,1)==2"
] | def test_run(content1,content2):
return ROP(content1,content2).public_Reverse_order_pair() | test_run | assert candidate([['class ROP', 'def _private_Reverse_order_pair', 'def public_Reverse_order_pair'], ['class ROP', 'def __private_Reverse_order_pair', 'def public_Reverse_order_pair']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/198 | Firstly, design an **NCT** class using Python language, which has an instance attribute **courses**, a private function **private_Number_courses_taken**, and a public function **public_Number_courses_taken**. Then, implement the following problem in the private function **private_Number_courses_taken**. Finally, call t... | [
"assert candidate([[100,200],[200,1300],[1000,1250],[2000,3200]])==3",
"assert candidate([[1,2]])==1",
"assert candidate([[3,2],[4,3]])==0"
] | def test_run(content1):
return NCT(content1).public_Number_courses_taken() | test_run | assert candidate([['class NCT', 'def _private_Number_courses_taken', 'def public_Number_courses_taken'], ['class NCT', 'def __private_Number_courses_taken', 'def public_Number_courses_taken']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/199 | Firstly, design a class **JI** using the Python language, which has an instance attribute **c**, a private function **private_Judging_integers**, and a public function **public_Judging_integers**. Then, in the private function **private_Judging_integers**, determine whether there exist two integers **a** and **b** such... | [
"assert candidate(5)==True",
"assert candidate(3)==False"
] | def test_run(content1):
return JI(content1).public_Judging_integers() | test_run | assert candidate([['class JI', 'def _private_Judging_integers', 'def public_Judging_integers'], ['class JI', 'def __private_Judging_integers', 'def public_Judging_integers']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/200 | First, design a class **SE** using the Python language, which has an instance attribute **equation**, a private function **private_solve_equation**, and a public function **public_solve_equation**. Then, implement the following problem in the private function **private_solve_equation**. Finally, call the private functi... | [
"assert candidate(\"x+5-3+x=6+x-2\")==\"x=2\"",
"assert candidate(\"x=x\")==\"Infinite solutions\"",
"assert candidate(\"2x=x\")==\"x=0\""
] | def test_run(content1):
return SE(content1).public_solve_equation() | test_run | assert candidate([['class SE', 'def _private_solve_equation', 'def public_solve_equation'], ['class SE', 'def __private_solve_equation', 'def public_solve_equation']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.