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/94
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 __init__(self, s, dictionary)", "def _private_Longest_string","def public_Longest_string"], ["class LS", "def __init__(self, s, dictionary)", "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/95
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 __init__(self, nums)", "def _private_Array_length","def public_Array_length"], ["class AL", "def __init__(self, nums)", "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/96
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 __init__(self, n)", "def _private_Construction_quantity","def public_Construction_quantity"], ["class CQ", "def __init__(self, n)", "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/97
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 __init__(self, w)", "def _private_Return_Subscript","def public_Return_Subscript"], ["class RS", "def __init__(self, w)", "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/98
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 __init__(self, board, click)", "def _private_Minesweeping_game","def public_Minesweeping_game"], ["class MG", "def __init__(self, board, click)", "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/99
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 __init__(self, nums, k)", "def _private_Number_Pairs","def public_Number_Pairs"], ["class NP", "def __init__(self, nums, k)", "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/100
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 __init__(self, num1, num2)", "def _String_product","def public_String_product"], ["class SOP", "def __init__(self, num1, num2)", "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/101
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 __init__(self, timePoints)", "def _Minimum_difference","def public_Minimum_difference"], ["class MTD", "def __init__(self, timePoints)", "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/102
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 __init__(self, nums)", "def _Number_occurrences","def public_Number_occurrences"], ["class NOO", "def __init__(self, nums)", "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/103
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 __init__(self, mat)", "def _private_Matrices_size","def public_Matrices_size"], ["class MS", "def __init__(self, mat)", "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/104
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 __init__(self, boxes)", "def _private_Remove_Box","def public_Remove_Box"], ["class RB", "def __init__(self, boxes)", "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/105
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 __init__(self, nums)", "def _private_Add_parentheses","def public_Add_parentheses"], ["class AP", "def __init__(self, nums)", "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/106
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 __init__(self, n)", "def _private_Minimum_integer","def public_Minimum_integer"], ["class MI", "def __init__(self, n)", "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/107
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 __init__(self, s)", "def _private_Invert_String","def public_Invert_String"], ["class IS", "def __init__(self, s)", "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/108
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 IS", "def __init__(self, s)", "def _private_Invert_String","def public_Invert_String"], ["class IS", "def __init__(self, s)", "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/109
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 __init__(self, n)", "def _private_Palindrome_integer","def public_Palindrome_integer"], ["class PI", "def __init__(self, n)", "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/110
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 __init__(self, s1, s2)", "def _private_Judgment_arrangement","def public_Judgment_arrangement"], ["class JA", "def __init__(self, s1, s2)", "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/111
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 __init__(self, nums)", "def _private_Shortest_subarray","def public_Shortest_subarray"], ["class SS", "def __init__(self, nums)", "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/112
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 __init__(self, word1, word2)", "def _private_Minimum_Steps","def public_Minimum_Steps"], ["class MS", "def __init__(self, word1, word2)", "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/113
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 __init__(self, trees)", "def _private_Return_Coordinates","def public_Return_Coordinates"], ["class RC", "def __init__(self, trees)", "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/114
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 __init__(self, expression)", "def _private_Minimal_Score","def public_Minimal_Score"], ["class MS", "def __init__(self, expression)", "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/115
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 __init__(self, p1, p2, p3, p4)", "def _Form_square","def public_Form_a_square"], ["class FAS", "def __init__(self, p1, p2, p3, p4)", "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/116
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 __init__(self, n)", "def _private_There_continuity","def public_There_continuity"], ["class TC", "def __init__(self, n)", "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/117
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 __init__(self, nums)", "def _private_Number_of_triples","def public_Number_of_triples"], ["class NOT", "def __init__(self, nums)", "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/118
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 __init__(self, tasks, n)", "def _private_Minimum_time","def public_Minimum_time"], ["class MT", "def __init__(self, tasks, n)", "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/119
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 __init__(self, n, k)", "def _private_Reverse_order_pair","def public_Reverse_order_pair"], ["class ROP", "def __init__(self, n, k)", "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/120
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 __init__(self, courses)", "def _private_Number_courses_taken","def public_Number_courses_taken"], ["class NCT", "def __init__(self, courses)", "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/121
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 __init__(self, c)", "def _private_Judging_integers","def public_Judging_integers"], ["class JI", "def __init__(self, c)", "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/122
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 __init__(self, equation)", "def _private_solve_equation","def public_solve_equation"], ["class SE", "def __init__(self, equation)", "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]...
OOP/123
Firstly, design an **LPC** class using Python language, which has an instance attribute **pairs**, a private function **private_Longest_pair_chain**, and a public function **public_Longest_pair_chain**. Then, implement the following problem in the private function **private_Longest_pair_chain**. Finally, call the priva...
[ "assert candidate([[1,2], [2,3], [3,4]])==2", "assert candidate([[1,2],[7,8],[4,5]])==3" ]
def test_run(content1): return LPC(content1).public_Longest_pair_chain()
test_run
assert candidate([["class LPC", "def __init__(self, pairs)", "def _private_Longest_pair_chain","def public_Longest_pair_chain"], ["class LPC", "def __init__(self, pairs)", "def __private_Longest_pair_chain","def public_Longest_pair_chain"]]) == 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 **PS** class using Python language, which has an instance attribute **s**, a private function **private_Palindrome_substring**, and a public function **public_Palindrome_substring**. Then, return the number of palindrome substrings in the string **s** within the private function **private_Palindrome_s...
[ "assert candidate(\"abc\")==3", "assert candidate(\"aaa\")==6" ]
def test_run(content1): return PS(content1).public_Palindrome_substring()
test_run
assert candidate([["class PS", "def __init__(self, s)", "def _private_Palindrome_substring","def public_Palindrome_substring"], ["class PS", "def __init__(self, s)", "def __private_Palindrome_substring","def public_Palindrome_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/125
Firstly, design an **RS** class using the Python language, which has instance attributes **dictionary** and **sentence**, a private function **private_Root_substitution**, and a public function **public_Root_substitution**. Then, implement the following problem in the private function **private_Root_substitution**. Fin...
[ "assert candidate([\"cat\",\"bat\",\"rat\"],\"the cattle was rattled by the battery\")==\"the cat was rat by the bat\"", "assert candidate([\"a\",\"b\",\"c\"],\"aadsfasf absbs bbab cadsfafs\")==\"a a b c\"" ]
def test_run(content1,content2): return RS(content1,content2).public_Root_substitution()
test_run
assert candidate([["class RS", "def __init__(self, dictionary, sentence)", "def _private_Root_substitution","def public_Root_substitution"], ["class RS", "def __init__(self, dictionary, sentence)", "def __private_Root_substitution","def public_Root_substitution"]]) == 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 an **MNO** class using Python language, which has an instance attribute **n**, a private function **Minimum_operations**, and a public function **public_Minimum_operations**. Then, implement the following problem in the private function **Minimum_operations**. Finally, call the private function **Minimu...
[ "assert candidate(3)==3", "assert candidate(1)==0" ]
def test_run(content1): return MNO(content1).public_Minimum_operations()
test_run
assert candidate([["class MNO", "def __init__(self, n)", "def _Minimum_operations","def public_Minimum_operations"], ["class MNO", "def __init__(self, n)", "def __Minimum_operations","def public_Minimum_operations"]]) == 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 **FPV** class using Python language, which has instance attributes **arr**, **k**, and **x**, a private function **private_Find_Proximity_Values**, and a public function **public_Find_Proximity_Values**. Then, implement the following problem in the private function **private_Find_Proximity_Values**. ...
[ "assert candidate([1,2,3,4,5],4,3)==[1,2,3,4]", "assert candidate([1,2,3,4,5],4,-1)==[1,2,3,4]" ]
def test_run(content1,content2,content3): return FPV(content1,content2,content3).public_Find_Proximity_Values()
test_run
assert candidate([["class FPV", "def __init__(self, arr, k, x)", "def _private_Find_Proximity_Values","def public_Find_Proximity_Values"], ["class FPV", "def __init__(self, arr, k, x)", "def __private_Find_Proximity_Values","def public_Find_Proximity_Values"]]) == 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 a **JS** class using the Python language, which has an instance attribute **nums**, a private function **private_Judgment_segmentation**, and a public function **public_Judgment_segmentation**. Then, implement the following problem in the private function **private_Judgment_segmentation**. Finally, call...
[ "assert candidate([1,2,3,3,4,5])==True", "assert candidate([1,2,3,3,4,4,5,5])==True", "assert candidate([1,2,3,4,4,5])==False" ]
def test_run(content1): return JS(content1).public_Judgment_segmentation()
test_run
assert candidate([["class JS", "def __init__(self, nums)", "def _private_Judgment_segmentation","def public_Judgment_segmentation"], ["class JS", "def __init__(self, nums)", "def _private_Judgment_segmentation","def public_Judgment_segmentation"]]) == 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
Firstly, design an **MPT** class using Python language, which has an instance attribute **s**, a private function **Minimum_Times**, and a public function **public_Minimum_Times**. Then, implement the following problem in the private function **Minimum_Times**. Finally, call the private function **Minimum_Times** in th...
[ "assert candidate(\"aaabbb\")==2", "assert candidate(\"aba\")==2" ]
def test_run(content1): return MPT(content1).public_Minimum_Times()
test_run
assert candidate([["class MPT", "def __init__(self, s)", "def _Minimum_Times","def public_Minimum_Times"], ["class MPT", "def __init__(self, s)", "def __Minimum_Times","def public_Minimum_Times"]]) == 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
Firstly, design an **NDC** class using Python language, which has an instance attribute **nums**, a private function **private_Non_decreasing_column**, and a public function **public_Non_decreasing_column**. Then, implement the following problem in the private function **private_Non_decreasing_column**. Finally, call t...
[ "assert candidate([4,2,3])==True", "assert candidate([4,2,1])==False" ]
def test_run(content1): return NDC(content1).public_Non_decreasing_column()
test_run
assert candidate([["class NDC", "def __init__(self, nums)", "def _private_Non_decreasing_column","def public_Non_decreasing_column"], ["class NDC", "def __init__(self, nums)", "def __private_Non_decreasing_column","def public_Non_decreasing_column"]]) == 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
Firstly, design an **AL** class using Python language, which has instance attributes **n** and **k**, a private function **private_Answer_List**, and a public function **public_Answer_List**. Then, return the constructed answer list **answer** in the private function **private_Answer_List**. Finally, call the private f...
[ "assert candidate(3,1)==[1, 2, 3]", "assert candidate(3,2)==[1, 3, 2]" ]
def test_run(content1,content2): return AL(content1,content2).public_Answer_List()
test_run
assert candidate([["class AL", "def __init__(self, n, k)", "def _private_Answer_List","def public_Answer_List"], ["class AL", "def __init__(self, n, k)", "def _private_Answer_List","def public_Answer_List"]]) == 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 a class named **LIS** using Python language, which has instance attribute **nums**, a private function **lo_in_sub**, and a public function **public_lo_in_sub**. Then, in the private function **lo_in_sub**, return the count of the longest increasing subsequence from the unsorted integer array **nums**. ...
[ "assert candidate([1,3,5,4,7])==2", "assert candidate([2,2,2,2,2])==5" ]
def test_run(content1): return LIS(content1).public_lo_in_sub()
test_run
assert candidate([["class LIS", "def __init__(self, nums)", "def _lo_in_sub","def public_lo_in_sub"], ["class LIS", "def __init__(self, nums)", "def __lo_in_sub","def public_lo_in_sub"]]) == 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 a **CDT** class using Python language, which has an instance attribute **forest**, a private function **private_Chop_down_trees**, and a public function **public_Chop_down_trees**. Then, implement the following problem in the private function **private_Chop_down_trees**. Finally, call the private functi...
[ "assert candidate([[1,2,3],[0,0,4],[7,6,5]])==6", "assert candidate([[1,2,3],[0,0,0],[7,6,5]])==-1", "assert candidate([[2,3,4],[0,0,5],[8,7,6]])==6" ]
def test_run(content1): return CDT(content1).public_Chop_down_trees()
test_run
assert candidate([["class CDT", "def __init__(self, forest)", "def _private_Chop_down_trees","def public_Chop_down_trees"], ["class CDT", "def __init__(self, forest)", "def __private_Chop_down_trees","def public_Chop_down_trees"]]) == 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
Firstly, design a **VS** class using Python language, which has an instance attribute **s**, a private function **private_Valid_String**, and a public function **public_Valid_String**. Then, implement the following problem in the private function **private_Valid_String**. Finally, call the private function **private_Va...
[ "assert candidate(\"()\")==True", "assert candidate(\"(*)\")==True", "assert candidate(\"(*))\")==True" ]
def test_run(content1): return VS(content1).public_Valid_String()
test_run
assert candidate([["class VS", "def __init__(self, s)", "def _private_Valid_String","def public_Valid_String"], ["class VS", "def __init__(self, s)", "def __private_Valid_String","def public_Valid_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/135
Firstly, design a class **ME** using the Python language, which has an instance attribute **cards**, a private function **private_mathematical_expression**, and a public function **public_mathematical_expression**. Then, implement the following problem in the private function **private_mathematical_expression**. Finall...
[ "assert candidate([4, 1, 8, 7])==True", "assert candidate([1, 2, 1, 2])==False" ]
def test_run(content1): return ME(content1).public_mathematical_expression()
test_run
assert candidate([["class ME", "def __init__(self, cards)", "def _private_mathematical_expression","def public_mathematical_expression"], ["class ME", "def __init__(self, cards)", "def __private_mathematical_expression","def public_mathematical_expression"]]) == 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
Firstly, design an **OS** class using Python language, which has instance attributes **a** and **b**, a private function **private_Overlay_substring**, and a public function **public_Overlay_substring**. Then, implement the following problem in the private function **private_Overlay_substring**. Finally, call the priva...
[ "assert candidate(\"abcd\",\"cdabcdab\")==3", "assert candidate(\"a\",\"aa\")==2", "assert candidate(\"a\",\"a\")==1", "assert candidate(\"abc\",\"wxyz\")==-1" ]
def test_run(content1,content2): return OS(content1,content2).public_Overlay_substring()
test_run
assert candidate([["class OS", "def __init__(self, a, b)", "def _private_Overlay_substring","def public_Overlay_substring"], ["class OS", "def __init__(self, a, b)", "def __private_Overlay_substring","def public_Overlay_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/137
Firstly, design a **KC** class using Python language, which has instance attributes **n**, **k**, **row**, and **column**, a private function **private_Knight_Chessboard**, and a public function **public_Knight_Chessboard**. Then, implement the following problem in the private function **private_Knight_Chessboard**. Fi...
[ "assert candidate(3,2,0,0)==0.0625", "assert candidate(1,0,0,0)==1.00000" ]
def test_run(content1,content2,content3,content4): return KC(content1,content2,content3,content4).public_Knight_Chessboard()
test_run
assert candidate([["class KC", "def __init__(self, n, k, row, column)", "def _private_Knight_Chessboard","def public_Knight_Chessboard"], ["class KC", "def __init__(self, n, k, row, column)", "def __private_Knight_Chessboard","def public_Knight_Chessboard"]]) == 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 an **MS** class using Python language, which has instance attributes **nums** and **k**, a private function **private_Maximum_subarray**, and a public function **public_Maximum_subarray**. Then, implement the following problem in the private function **private_Maximum_subarray**. Finally, call the priva...
[ "assert candidate([1,2,1,2,6,7,5,1],2)==[0,3,5]", "assert candidate([1,2,1,2,1,2,1,2,1],2)==[0,2,4]" ]
def test_run(content1,content2): return MS(content1,content2).public_Maximum_subarray()
test_run
assert candidate([["class MS", "def __init__(self, nums, k)", "def _private_Maximum_subarray","def public_Maximum_subarray"], ["class MS", "def __init__(self, nums, k)", "def __private_Maximum_subarray","def public_Maximum_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/139
Firstly, design a class named **SW** using Python language, which has instance attributes **stickers** and **target**, a private function **private_Sticker_Words**, and a public function **public_Sticker_Words**. Then, implement the following problem in the private function **private_Sticker_Words**. Finally, call the ...
[ "assert candidate([\"with\",\"example\",\"science\"],\"thehat\")==3", "assert candidate([\"notice\",\"possible\"],\"basicbasic\")==-1" ]
def test_run(content1,content2): return SW(content1,content2).public_Sticker_Words()
test_run
assert candidate([["class SW", "def __init__(self, stickers, target)", "def _private_Sticker_Words","def public_Sticker_Words"], ["class SW", "def __init__(self, stickers, target)", "def __private_Sticker_Words","def public_Sticker_Words"]]) == 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 **MT** class using the Python language, which has instance attributes **words** and **k**, a private function **private_Most_times**, and a public function **public_Most_times**. Then, in the private function **private_Most_times**, return the top **k** most frequently occurring words from a given wo...
[ "assert candidate([\"i\", \"love\", \"leetcode\", \"i\", \"love\", \"coding\"],2)==[\"i\", \"love\"]", "assert candidate([\"the\", \"day\", \"is\", \"sunny\", \"the\", \"the\", \"the\", \"sunny\", \"is\", \"is\"],4)==[\"the\", \"is\", \"sunny\", \"day\"]" ]
def test_run(content1,content2): return MT(content1,content2).public_Most_times()
test_run
assert candidate([["class MT", "def __init__(self, words, k)", "def _private_Most_times","def public_Most_times"], ["class MT", "def __init__(self, words, k)", "def __private_Most_times","def public_Most_times"]]) == 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
Firstly, design an **AA** class using the Python language, which has an instance attribute **n**, a private function **private_Alternating_appearance**, and a public function **public_Alternating_appearance**. Then, implement the following problem in the private function **private_Alternating_appearance**. Finally, cal...
[ "assert candidate(5)==True", "assert candidate(7)==False", "assert candidate(11)==False" ]
def test_run(content1): return AA(content1).public_Alternating_appearance()
test_run
assert candidate([["class AA", "def __init__(self, n)", "def _private_Alternating_appearance","def public_Alternating_appearance"], ["class AA", "def __init__(self, n)", "def __private_Alternating_appearance","def public_Alternating_appearance"]]) == 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 an **IA** class using Python language, which has an instance attribute **grid**, a private function **private_Island_area**, and a public function **public_Island_area**. Then, implement the following problem in the private function **private_Island_area**. Finally, call the private function **private_I...
[ "assert candidate([[0,0,1,0,0,0,0,1,0,0,0,0,0],[0,0,0,0,0,0,0,1,1,1,0,0,0],[0,1,1,0,1,0,0,0,0,0,0,0,0],[0,1,0,0,1,1,0,0,1,0,1,0,0],[0,1,0,0,1,1,0,0,1,1,1,0,0],[0,0,0,0,0,0,0,0,0,0,1,0,0],[0,0,0,0,0,0,0,1,1,1,0,0,0],[0,0,0,0,0,0,0,1,1,0,0,0,0]])==6", "assert candidate([[0,0,0,0,0,0,0,0]])==0" ]
def test_run(content1): return IA(content1).public_Island_area()
test_run
assert candidate([["class IA", "def __init__(self, grid)", "def _private_Island_area","def public_Island_area"], ["class IA", "def __init__(self, grid)", "def __private_Island_area","def public_Island_area"]]) == 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
Firstly, design an **ES** class using Python language, which has instance attributes **nums** and **k**, a private function **private_Equal_sum**, and a public function **public_Equal_sum**. Then, in the private function **private_Equal_sum**, determine whether it is possible to divide this array into **k** non-empty s...
[ "assert candidate([4, 3, 2, 3, 5, 2, 1],4)==True", "assert candidate([1,2,3,4],3)==False" ]
def test_run(content1,content2): return ES(content1,content2).public_Equal_sum()
test_run
assert candidate([["class ES", "def __init__(self, nums, k)", "def _private_Equal_sum","def public_Equal_sum"], ["class ES", "def __init__(self, nums, k)", "def __private_Equal_sum","def public_Equal_sum"]]) == 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
Firstly, design a **BS** class using Python language, which has an instance attribute **positions**, a private function **private_Block_stacking**, and a public function **public_Block_stacking**. Then, implement the following problem in the private function **private_Block_stacking**. Finally, call the private functio...
[ "assert candidate([[1,2],[2,3],[6,1]])==[2,5,5]", "assert candidate([[100,100],[200,100]])==[100,100]" ]
def test_run(content1): return BS(content1).public_Block_stacking()
test_run
assert candidate([["class BS", "def __init__(self, positions)", "def _private_Block_stacking","def public_Block_stacking"], ["class BS", "def __init__(self, positions)", "def __private_Block_stacking","def public_Block_stacking"]]) == 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 a **DC** class using the Python language, which has instance attributes **s1** and **s2**, a private function **private_Delete_Characters**, and a public function **public_Delete_Characters**. Then, in the private function **private_Delete_Characters**, return the minimum sum of the ASCII values of the ...
[ "assert candidate(\"sea\",\"eat\")==231", "assert candidate(\"delete\",\"leet\")==403" ]
def test_run(content1,content2): return DC(content1,content2).public_Delete_Characters()
test_run
assert candidate([["class DC", "def __init__(self, s1, s2)", "def _private_Delete_Characters","def public_Delete_Characters"], ["class DC", "def __init__(self, s1, s2)", "def __private_Delete_Characters","def public_Delete_Characters"]]) == 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 a **POE** class using Python language, which has instance attributes **nums** and **k**, a private function **private_Product_of_elements**, and a public function **public_Product_of_elements**. Then, in the private function **private_Product_of_elements**, return the number of continuous subarrays wher...
[ "assert candidate([10,5,2,6],100)==8", "assert candidate([1,2,3],0)==0" ]
def test_run(content1,content2): return POE(content1,content2).public_Product_of_elements()
test_run
assert candidate([["class POE", "def __init__(self, nums, k)", "def _private_Product_of_elements","def public_Product_of_elements"], ["class POE", "def __init__(self, nums, k)", "def __private_Product_of_elements","def public_Product_of_elements"]]) == 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 a **BS** class using Python language, which has instance attributes **prices** and **fee**, a private function **private_buy_share**, and a public function **public_buy_share**. Then, implement the following problem in the private function **private_buy_share**. Finally, call the private function **priv...
[ "assert candidate([1, 3, 2, 8, 4, 9],2)==8", "assert candidate([1,3,7,5,10,3],3)==6" ]
def test_run(content1,content2): return BS(content1,content2).public_buy_share()
test_run
assert candidate([["class BS", "def __init__(self, prices, fee)", "def _private_buy_share","def public_buy_share"], ["class BS", "def __init__(self, prices, fee)", "def __private_buy_share","def public_buy_share"]]) == 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
Firstly, design a **BC** class using the Python language, which has an instance attribute **bits**, a private function **private_Bit_character**, and a public function **public_Bit_character**. Then, implement the following problem in the private function **private_Bit_character**. Finally, call the private function **...
[ "assert candidate([1, 0, 0])==True", "assert candidate([1,1,1,0])==False" ]
def test_run(content1): return BC(content1).public_Bit_character()
test_run
assert candidate([["class BC", "def __init__(self, bits)", "def _private_Bit_character","def public_Bit_character"], ["class BC", "def __init__(self, bits)", "def __private_Bit_character","def public_Bit_character"]]) == 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
Firstly, design a **BL** class using Python language, which has instance attributes **nums1** and **nums2**, a private function **private_BLongest_length**, and a public function **public_BLongest_length**. Then, in the private function **private_BLongest_length**, return the length of the longest common subarray from ...
[ "assert candidate([1,2,3,2,1],[3,2,1,4,7])==3", "assert candidate([0,0,0,0,0],[0,0,0,0,0])==5" ]
def test_run(content1,content2): return BL(content1,content2).public_BLongest_length()
test_run
assert candidate([["class BL", "def __init__(self, nums1, nums2)", "def _private_BLongest_length","def public_BLongest_length"], ["class BL", "def __init__(self, nums1, nums2)", "def __private_BLongest_length","def public_BLongest_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/150
Firstly, design an **AD** class using Python language, which has instance attributes **nums** and **k**, a private function **private_absolute_difference**, and a public function **public_absolute_difference**. Then, implement the following problem in the private function **private_absolute_difference**. Finally, call ...
[ "assert candidate([1,3,1],1)==0", "assert candidate([1,1,1],2)==0", "assert candidate([1,6,1],3)==5" ]
def test_run(content1,content2): return AD(content1,content2).public_absolute_difference()
test_run
assert candidate([["class AD", "def __init__(self, nums, k)", "def _private_absolute_difference","def public_absolute_difference"], ["class AD", "def __init__(self, nums, k)", "def __private_absolute_difference","def public_absolute_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/151
Firstly, design an **ED** class using the Python language, which has an instance attribute **words**, a private function **private_English_Dictionary**, and a public function **public_English_Dictionary**. Then, implement the following problem in the private function **private_English_Dictionary**. Finally, call the pr...
[ "assert candidate([\"w\",\"wo\",\"wor\",\"worl\", \"world\"])==\"world\"", "assert candidate([\"a\", \"banana\", \"app\", \"appl\", \"ap\", \"apply\", \"apple\"])==\"apple\"" ]
def test_run(content1): return ED(content1).public_English_Dictionary()
test_run
assert candidate([["class ED", "def __init__(self, words)", "def _private_English_Dictionary","def public_English_Dictionary"], ["class ED", "def __init__(self, words)", "def __private_English_Dictionary","def public_English_Dictionary"]]) == 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 **LS** class using Python language, which has instance attributes **head** and **k**, a private function **private_List_separation**, and a public function **public_List_separation**. Then, implement the following problem in the private function **private_List_separation**. Finally, call the private ...
[ "assert candidate([1,2,3],5)==[[1],[2],[3],[],[]]", "assert candidate([1,2,3,4,5,6,7,8,9,10],3)==[[1,2,3,4],[5,6,7],[8,9,10]]" ]
def test_run(content1,content2): return LS(content1,content2).public_public_List_separation()
test_run
assert candidate([["class LS", "def __init__(self, head, k)", "def _private_List_separation","def public_List_separation"], ["class LS", "def __init__(self, head, k)", "def __private_List_separation","def public_List_separation"]]) == 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
Firstly, design a **NOS** class using the Python language, which has an instance attribute **s**, a private function **private_Number_of_sequences**, and a public function **public_Number_of_sequences**. Then, in the private function **private_Number_of_sequences**, return the number of different non-empty palindrome s...
[ "assert candidate('bccb')==6", "assert candidate('abcdabcdabcdabcdabcdabcdabcdabcddcbadcbadcbadcbadcbadcbadcbadcba')==104860361" ]
def test_run(content1): return NOS(content1).public_Number_of_sequences()
test_run
assert candidate([["class NOS", "def __init__(self, s)", "def _private_Number_of_sequences","def public_Number_of_sequences"], ["class NOS", "def __init__(self, s)", "def __private_Number_of_sequences","def public_Number_of_sequences"]]) == 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 an **MI** class using Python language, which has an instance attribute **n**, a private function **private_monotonic_increase**, and a public function **public_monotonic_increase**. Then, implement the following problem in the private function **private_monotonic_increase**. Finally, call the private fu...
[ "assert candidate(10)==9", "assert candidate(1234)==1234", "assert candidate(332)==299" ]
def test_run(content1): return MI(content1).public_monotonic_increase()
test_run
assert candidate([["class MI", "def __init__(self, n)", "def _private_monotonic_increase","def public_monotonic_increase"], ["class MI", "def __init__(self, n)", "def __private_monotonic_increase","def public_monotonic_increase"]]) == 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 a class **TR** using the Python language, which has an instance attribute **temperatures**, a private function **private_Temperature_rise**, and a public function **public_Temperature_rise**. Then, implement the following problem in the private function **private_Temperature_rise**. Finally, call the pr...
[ "assert candidate([73,74,75,71,69,72,76,73])==[1,1,4,2,1,1,0,0]", "assert candidate([30,40,50,60])==[1,1,1,0]", "assert candidate([30,60,90])==[1,1,0]" ]
def test_run(content1): return TR(content1).public_Temperature_rise()
test_run
assert candidate([["class TR", "def __init__(self, temperatures)", "def _private_Temperature_rise","def public_Temperature_rise"], ["class TR", "def __init__(self, temperatures)", "def __private_Temperature_rise","def public_Temperature_rise"]]) == 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
Firstly, design a class **MN** using the Python language, which has an instance attribute **nums**, a private function **private_Maximum_number**, and a public function **public_Maximum_number**. Then, implement the following problem in the private function **private_Maximum_number**. Finally, call the private function...
[ "assert candidate([3,4,2])==6", "assert candidate([2,2,3,3,3,4])==9" ]
def test_run(content1): return MN(content1).public_Maximum_number()
test_run
assert candidate([["class MN", "def __init__(self, nums)", "def _private_Maximum_number","def public_Maximum_number"], ["class MN", "def __init__(self, nums)", "def __private_Maximum_number","def public_Maximum_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/157
Firstly, design a class **NN** using the Python language, which has instance attributes **times**, **n** and **k**, a private function **private_network_node**, and a public function **public_network_node**. Then, implement the following problem in the private function **private_network_node**. Finally, call the privat...
[ "assert candidate([[2,1,1],[2,3,1],[3,4,1]],4,2)==2", "assert candidate([[1,2,1]],2,1)==1", "assert candidate([[1,2,1]],2,2)==-1" ]
def test_run(content1,content2,content3): return NN(content1,content2,content3).public_network_node()
test_run
assert candidate([["class NN", "def __init__(self, times, n, k)", "def _private_network_node","def public_network_node"], ["class NN", "def __init__(self, times, n, k)", "def __private_network_node","def public_network_node"]]) == 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 **INA** class using Python language, which has an instance attribute **target**, a private function **private_Infinite_number_axis**, and a public function **public_Infinite_number_axis**. Then, implement the following problem in the private function **private_Infinite_number_axis**. Finally, call th...
[ "assert candidate(2)==3", "assert candidate(3)==2" ]
def test_run(content1): return INA(content1).public_Infinite_number_axis()
test_run
assert candidate([["class INA", "def __init__(self, target)", "def _private_Infinite_number_axis","def public_Infinite_number_axis"], ["class INA", "def __init__(self, target)", "def __private_Infinite_number_axis","def public_Infinite_number_axis"]]) == 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
Firstly, design an **IC** class using Python language, which has an instance attribute **intervals**, a private function **private_Include_Collection**, and a public function **public_Include_Collection**. Then, implement the following problem in the private function **private_Include_Collection**. Finally, call the pr...
[ "assert candidate([[1,3],[3,7],[8,9]])==5", "assert candidate([[1,3],[1,4],[2,5],[3,5]])==3", "assert candidate([[1,2],[2,3],[2,4],[4,5]])==5" ]
def test_run(content1): return IC(content1).public_Include_Collection()
test_run
assert candidate([["class IC", "def __init__(self, intervals)", "def _private_Include_Collection","def public_Include_Collection"], ["class IC", "def __init__(self, intervals)", "def __private_Include_Collection","def public_Include_Collection"]]) == 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 **SP** using Python language, which has an instance attribute **s**, a private function **private_String_partitioning**, and a public function **public_String_partitioning**. Then, implement the following problem in the private function **private_String_partitioning**. Finally, call the private ...
[ "assert candidate(\"ababcbacadefegdehijhklij\")==[9,7,8]", "assert candidate(\"eccbbbbdec\")==[10]" ]
def test_run(content1): return SP(content1).public_String_partitioning()
test_run
assert candidate([["class SP", "def __init__(self, s)", "def _private_String_partitioning","def public_String_partitioning"], ["class SP", "def __init__(self, s)", "def __private_String_partitioning","def public_String_partitioning"]]) == 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 a **PS** class using Python language, which has instance attributes **n** and **mines**, a private function **private_Plus_sign**, and a public function **public_Plus_sign**. Then, implement the following problem in the private function **private_Plus_sign**. Finally, call the private function **private...
[ "assert candidate(5,[[4, 2]])==2", "assert candidate(1,[[0, 0]])==0" ]
def test_run(content1,content2): return PS(content1,content2).public_Plus_sign()
test_run
assert candidate([["class PS", "def __init__(self, n, mines)", "def _private_Plus_sign","def public_Plus_sign"], ["class PS", "def __init__(self, n, mines)", "def __private_Plus_sign","def public_Plus_sign"]]) == 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 **ES** class using Python language, which has an instance attribute **row**, a private function **private_Exchange_seats**, and a public function **public_Exchange_seats**. Then, implement the following problem in the private function **private_Exchange_seats**. Finally, call the private function **p...
[ "assert candidate([0,2,1,3])==1", "assert candidate([3,2,0,1])==0" ]
def test_run(content1): return ES(content1).public_Exchange_seats()
test_run
assert candidate([["class ES", "def __init__(self, row)", "def _private_Exchange_seats","def public_Exchange_seats"], ["class ES", "def __init__(self, row)", "def __private_Exchange_seats","def public_Exchange_seats"]]) == 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 a **JM** class using Python language, which has an instance attribute **matrix**, a private function **private_judgment_matrix**, and a public function **public_judgment_matrix**. Then, in the private function **private_judgment_matrix**, determine whether a given m x n **matrix** is a Toeplitz matrix. ...
[ "assert candidate([[1,2,3,4],[5,1,2,3],[9,5,1,2]])==True", "assert candidate([[1,2],[2,2]])==False" ]
def test_run(content1): return JM(content1).public_judgment_matrix()
test_run
assert candidate([["class JM", "def __init__(self, matrix)", "def _private_judgment_matrix","def public_judgment_matrix"], ["class JM", "def __init__(self, matrix)", "def _private_judgment_matrix","def public_judgment_matrix"]]) == 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
First, design an **RL** class using the Python language, which has an instance attribute **s**, a private function **private_Rearrange_letters**, and a public function **public_Rearrange_letters**. Then, implement the following problem in the private function **private_Rearrange_letters**. Finally, call the private fun...
[ "assert candidate(\"aab\")==\"aba\"", "assert candidate(\"aaab\")==\"\"" ]
def test_run(content1): return RL(content1).public_Rearrange_letters()
test_run
assert candidate([["class RL", "def __init__(self, s)", "def _private_Rearrange_letters","def public_Rearrange_letters"], ["class RL", "def __init__(self, s)", "def _private_Rearrange_letters","def public_Rearrange_letters"]]) == 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
Firstly, design an **MNB** class using the Python language, which has an instance attribute **arr**, a private function **private_Maximum_number_blocks**, and a public function **public_Maximum_number_blocks**. Then, implement the following problem in the private function **private_Maximum_number_blocks**. Finally, cal...
[ "assert candidate([5,4,3,2,1])==1", "assert candidate([2,1,3,4,4])==4" ]
def test_run(content1): return MNB(content1).public_Maximum_number_blocks()
test_run
assert candidate([["class MNB", "def __init__(self, arr)", "def _private_Maximum_number_blocks","def public_Maximum_number_blocks"], ["class MNB", "def __init__(self, arr)", "def __private_Maximum_number_blocks","def public_Maximum_number_blocks"]]) == 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
Firstly, design a class named **SS** using Python language, which includes an instance attribute **arr**, a private function **private_Sort_separately**, and a public function **public_Sort_separately**. Then, implement the following problem in the private function **private_Sort_separately**. Finally, call the private...
[ "assert candidate([4,3,2,1,0])==1", "assert candidate([1,0,2,3,4])==4" ]
def test_run(content1): return SS(content1).public_Sort_separately()
test_run
assert candidate([["class SS", "def __init__(self, arr)", "def _private_Sort_separately","def public_Sort_separately"], ["class SS", "def __init__(self, arr)", "def __private_Sort_separately","def public_Sort_separately"]]) == 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 class **SPB** using Python language, which has an instance attribute **board**, a private function **private_Solving_puzzle_board**, and a public function **public_Solving_puzzle_board**. Then, implement the following problem in the private function **private_Solving_puzzle_board**. Finally, call the ...
[ "assert candidate([[1,2,3],[4,0,5]])==1", "assert candidate([[1,2,3],[5,4,0]])==-1", "assert candidate([[4,1,2],[5,0,3]])==5" ]
def test_run(content1): return SPB(content1).public_Solving_puzzle_board()
test_run
assert candidate([["class SPB", "def __init__(self, board)", "def _private_Solving_puzzle_board","def public_Solving_puzzle_board"], ["class SPB", "def __init__(self, board)", "def __private_Solving_puzzle_board","def public_Solving_puzzle_board"]]) == 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
Firstly, design a class **LI** using Python language, which has an instance attribute **nums**, a private function **private_Local_inversion**, and a public function **public_Local_inversion**. Then, implement the following problem in the private function **private_Local_inversion**. Finally, call the private function ...
[ "assert candidate([1,0,2])==True", "assert candidate([1,2,0])==False" ]
def test_run(content1): return LI(content1).public_Local_inversion()
test_run
assert candidate([["class LI", "def __init__(self, nums)", "def _private_Local_inversion","def public_Local_inversion"], ["class LI", "def __init__(self, nums)", "def __private_Local_inversion","def public_Local_inversion"]]) == 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 a class **GS** using the Python language, which has an instance attribute **grid**, a private function **private_Grid_swimming**, and a public function **public_Grid_swimming**. Then, implement the following problem in the private function **private_Grid_swimming**. Finally, call the private function **...
[ "assert candidate([[0,2],[1,3]])==3", "assert candidate([[0,1,2,3,4],[24,23,22,21,5],[12,13,14,15,16],[11,17,18,19,20],[10,9,8,7,6]])==16" ]
def test_run(content1): return GS(content1).public_Grid_swimming()
test_run
assert candidate([["class GS", "def __init__(self, grid)", "def _private_Grid_swimming","def public_Grid_swimming"], ["class GS", "def __init__(self, grid)", "def __private_Grid_swimming","def public_Grid_swimming"]]) == 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
Firstly, design a **GNR** class using Python language, which has instance attributes **n** and **k**, a private function **private_Given_number_rows**, and a public function **public_Given_number_rows**. Then, implement the following problem in the private function **private_Given_number_rows**. Finally, call the priva...
[ "assert candidate(1,1)==0", "assert candidate(2,1)==0", "assert candidate(2,2)==1" ]
def test_run(content1,content2): return GNR(content1,content2).public_Given_number_rows()
test_run
assert candidate([["class GNR", "def __init__(self, n, k)", "def _private_Given_number_rows","def public_Given_number_rows"], ["class GNR", "def __init__(self, n, k)", "def __private_Given_number_rows","def public_Given_number_rows"]]) == 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 a **CN** class using Python language, which has instance attributes **sx**, **sy**, **tx**, and **ty**, a private function **private_Convert_numbers**, and a public function **public_Convert_numbers**. Then, implement the following problem in the private function **private_Convert_numbers**. Finally, ca...
[ "assert candidate(1,1,3,5)==True", "assert candidate(1,1,2,2)==False", "assert candidate(1,1,1,1)==True" ]
def test_run(content1,content2,content3,content4): return CN(content1,content2,content3,content4).public_Convert_numbers()
test_run
assert candidate([["class CN", "def __init__(self, sx, sy, tx, ty)", "def _private_Convert_numbers","def public_Convert_numbers"], ["class CN", "def __init__(self, sx, sy, tx, ty)", "def __private_Convert_numbers","def public_Convert_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/172
First, design a class **FR** using the Python language, which has an instance attribute **answers**, a private function **private_Forest_Rabbit**, and a public function **public_Forest_Rabbit**. Then, implement the following problem in the private function **private_Forest_Rabbit**. Finally, call the private function *...
[ "assert candidate([1,1,2])==5", "assert candidate([10,10,10])==11" ]
def test_run(content1): return FR(content1).public_Forest_Rabbit()
test_run
assert candidate([["class FR", "def __init__(self, answers)", "def _private_Forest_Rabbit","def public_Forest_Rabbit"], ["class FR", "def __init__(self, answers)", "def __private_Forest_Rabbit","def public_Forest_Rabbit"]]) == 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 a class **NM** using the Python language, which has an instance attribute **board**, a private function **private_Network_Matrix**, and a public function **public_Network_Matrix**. Then, implement the following problem in the private function **private_Network_Matrix**. Finally, call the private functio...
[ "assert candidate([[0,1,1,0],[0,1,1,0],[1,0,0,1],[1,0,0,1]])==2", "assert candidate([[0,1],[1,0]])==0", "assert candidate([[1,0],[1,0]])==-1" ]
def test_run(content1): return NM(content1).public_Network_Matrix()
test_run
assert candidate([["class NM", "def __init__(self, board)", "def _private_Network_Matrix","def public_Network_Matrix"], ["class NM", "def __init__(self, board)", "def __private_Network_Matrix","def public_Network_Matrix"]]) == 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 **CC** using Python language, which has an instance attribute **s**, a private function **private_Change_Case**, and a public function **public_Change_Case**. Then, implement the following problem in the private function **private_Change_Case**. Finally, call the private function **private_Chang...
[ "assert candidate(\"a1b2\")==[\"a1b2\", \"a1B2\", \"A1b2\", \"A1B2\"]", "assert candidate(\"3z4\")==[\"3z4\",\"3Z4\"]" ]
def test_run(content1): return CC(content1).public_Change_Case()
test_run
assert candidate([["class CC", "def __init__(self, s)", "def _private_Change_Case","def public_Change_Case"], ["class CC", "def __init__(self, s)", "def __private_Change_Case","def public_Change_Case"]]) == 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 a class **MS** using the Python language, which has instance attributes **arr** and **k**, a private function **private_Minimum_score**, and a public function **public_Minimum_score**. Then, implement the following problem in the private function **private_Minimum_score**. Finally, call the private func...
[ "assert candidate([1,2,3,5],3)==[2,5]", "assert candidate([1,7],1)==[1,7]" ]
def test_run(content1,content2): return MS(content1,content2).public_Minimum_score()
test_run
assert candidate([["class MS", "def __init__(self, arr, k)", "def _private_Minimum_score","def public_Minimum_score"], ["class MS", "def __init__(self, arr, k)", "def __private_Minimum_score","def public_Minimum_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/176
Firstly, design a **PM** class using Python language, which has instance attributes **order** and **s**, a private function **private_Permutation_matching**, and a public function **public_Permutation_matching**. Then, implement the following problem in the private function **private_Permutation_matching**. Finally, ca...
[ "assert candidate(\"cba\",\"abcd\")==\"cbad\"", "assert candidate(\"cbafg\",\"abcd\")==\"cbad\"" ]
def test_run(content1,content2): return PM(content1,content2).public_Permutation_matching()
test_run
assert candidate([["class PM", "def __init__(self, order, s)", "def _private_Permutation_matching","def public_Permutation_matching"], ["class PM", "def __init__(self, order, s)", "def _private_Permutation_matching","def public_Permutation_matching"]]) == 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 **NW** using the Python language, which has instance attributes **s** and **words**, a private function **private_Number_words**, and a public function **public_Number_words**. Then, in the private function **private_Number_words**, return the number of words in words[i] that are subsequences of...
[ "assert candidate(\"abcde\",[\"a\",\"bb\",\"acd\",\"ace\"])==3", "assert candidate(\"dsahjpjauf\",[\"ahjpjau\",\"ja\",\"ahbwzgqnuk\",\"tnmlanowax\"])==2" ]
def test_run(content1,content2): return NW(content1,content2).public_Number_words()
test_run
assert candidate([["class NW", "def __init__(self, s, words)", "def _private_Number_words","def public_Number_words"], ["class NW", "def __init__(self, s, words)", "def __private_Number_words","def public_Number_words"]]) == 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 class **NI** using Python language, which has an instance attribute **k**, a private function **private_nonnegative_integer**, and a public function **public_nonnegative_integer**. Then, implement the following problem in the private function **private_nonnegative_integer**. Finally, call the private ...
[ "assert candidate(0)==5", "assert candidate(5)==0", "assert candidate(3)==5" ]
def test_run(content1): return NI(content1).public_nonnegative_integer()
test_run
assert candidate([["class NI", "def __init__(self, k)", "def _private_nonnegative_integer","def public_nonnegative_integer"], ["class NI", "def __init__(self, k)", "def __private_nonnegative_integer","def public_nonnegative_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/0
First, write a **WDS** class using the Python language. Then, within the WDS class, create a public function called **without_duplicates** to implement finding the length of the longest substring in a given string **s** that does not contain any duplicate characters.
[ "assert candidate(\"abcabcbb\")==3", "assert candidate(\"bbbbb\")==1", "assert candidate(\"pwwkew\")==3" ]
def test_run(content1): return WDS().without_duplicates(content1)
test_run
assert candidate([["class WDS", "def without_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/1
First, design a class called **MNS** in Python, which has an instance attribute called **machines**, a private function called **private_Ministeps**, and a public function called **public_Ministeps**. Then, implement the following problem in the private function **private_Ministeps**. Finally, call the private function...
[ "assert candidate([1,0,5])==3", "assert candidate([0,3,0])==2", "assert candidate([0,2,0])==-1" ]
def test_run(content1): return MNS(content1).public_Minimum_number_steps()
test_run
assert candidate([["class MNS", "def public_Ministeps", "def __private_Ministeps"],["class MNS", "def public_Ministeps", "def _private_Ministeps"]]) == 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/2
First, write a class called **FTM** using the Python language. Then, within the **FTM** class, create a public function called **find_the_median** that returns the median of two sorted arrays, **nums1** and **nums2**.
[ "assert candidate([1,3], [2])==2.00000", "assert candidate([1,2], [3,4])==2.50000" ]
def test_run(content1,content2): return FTM().find_the_median(content1,content2)
test_run
assert candidate([["class FTM", "def find_the_median"]]) == 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/3
First, write a **PDSB** class using the Python language. Then, within the **PDSB** class, implement a public **pa_substring** function to find the longest palindrome substring in string **s**.
[ "assert candidate(\"babad\")==\"bab\"", "assert candidate(\"cbbd\")==\"bb\"" ]
def test_run(content1): return PDSB().pa_substring(content1)
test_run
assert candidate([["class PDSB", "def pa_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/4
First, write a **ZZPTN** class using the Python language, then write a public **Zigzag_pattern** function in the **ZZPTN** class to solve the following problem. Problem: Given a string **s** and an integer **numRows**, arrange the string **s** from top to bottom and from left to right in a Z shape according to the give...
[ "assert candidate(\"PAYPALISHIRING\", 3)==\"PAHNAPLSIIGYIR\"", "assert candidate(\"PAYPALISHIRING\", 4)==\"PINALSIGYAHRPI\"", "assert candidate(\"A\", 1)==\"A\"" ]
def test_run(content1,content2): return ZZPTN().Zigzag_pattern(content1,content2)
test_run
assert candidate([["class ZZPTN", "def Zigzag_pattern"]]) == 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/5
First, write an **ITOC** class using the Python language. Then, within the **ITOC** class, create a public function called **Invert_outcome** that takes a 32-bit signed integer **x** as input and returns the result of reversing the numerical part of **x**.
[ "assert candidate(123)==321", "assert candidate(-123)==-321", "assert candidate(120)==21", "assert candidate(0)==0" ]
def test_run(content1): return ITOC().Invert_outcome(content1)
test_run
assert candidate([["class ITOC", "def Invert_outcome"]]) == 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/6
First, write a **PDIT** class using Python language. Then, within the **PDIT** class, write a public function named **Palindromic_integer**. This function should determine whether a given integer **x** is a palindromic integer. If it is, the function should return True; otherwise, it should return False.
[ "assert candidate(121)==True", "assert candidate(-121)==False", "assert candidate(10)==False" ]
def test_run(content1): return PDIT().Palindromic_integer(content1)
test_run
assert candidate([["class PDIT", "def Palindromic_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/7
First, write a **RLMH** class using the Python language. Then, within the **RLMH** class, create a public **rule_matching** function that implements a regular expression matching for a given string **s** and a character pattern **p**, using the following rules: 1. '.' matches any single character; 2. '*' matches zero o...
[ "assert candidate(\"aa\", \"a\")==False", "assert candidate(\"aa\", \"a*\")==True", "assert candidate(\"ab\", \".*\")==True" ]
def test_run(content1,content2): return RLMH().rule_matching(content1,content2)
test_run
assert candidate([["class RLMH", "def rule_matching"]]) == 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/8
First, write a **LCMP** class using the Python language. Then, within the **LCMP** class, create a public function called **longest_common_prefix** to find the longest common prefix among an array of strings. If no common prefix exists, return an empty string "".
[ "assert candidate([\"flower\",\"flow\",\"flight\"])==\"fl\"", "assert candidate([\"dog\",\"racecar\",\"car\"])==\"\"" ]
def test_run(content1,content2,content3): return LCMP().longest_common_prefix(content1,content2,content3)
test_run
assert candidate([["class LCMP", "def longest_common_prefix"]]) == 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/9
First, write a **TSOTN** class using the Python language. Then, within the **TSOTN** class, create a public function called **sum_three_numbers**. This function takes in an integer array called **nums** with a length of **n**, and a target value called **target**. The function selects three integers from **nums** in su...
[ "assert candidate([-1,2,1,-4], 1)==2", "assert candidate([0,0,0], 1)==0" ]
def test_run(content1,content2): return TSOTN().sum_three_numbers(content1,content2)
test_run
assert candidate([["class TSOTN", "def sum_three_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/10
Firstly, write a class **VLD_ST** using the Python language, then write a public function **valid_string** within the **VLD_ST** class to judge whether a given string **s**, which only includes '(',')','{','}','[',']', is valid or not. A valid string must meet the following conditions: 1. The left bracket must be clo...
[ "assert candidate(\"()\")==True", "assert candidate(\"()[]{}\")==True", "assert candidate(\"(]\")==False" ]
def test_run(content1): return VLD_ST().valid_string(content1)
test_run
assert candidate([["class VLD_ST", "def valid_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/11
First, write a **VDPT** class using the Python language. Then, within the **VDPT** class, create a public **valid_parentheses** function. This function should take an integer **n** as input, representing the number of pairs of parentheses to generate. The function should then print out all possible and valid combinatio...
[ "assert candidate(3)==[\"((()))\",\"(()())\",\"(())()\",\"()(())\",\"()()()==[\"((()))\",\"(()())\",\"(())()\",\"()(())\",\"()()()\"]", "assert candidate(1)==[\"()==[\"()\"]", "assert candidate(\"(]\")==False" ]
def test_run(content1): return VDPT().valid_parentheses(content1)
test_run
assert candidate([["class VDPT", "def valid_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/12
First, write a **NLAR** class using the Python language. Then, within the **NLAR** class, create a public function called **new_length_removal**. This function should take an array called **nums** and a value called **val** as input. The function should remove all elements in the array that are equal to **val**, and re...
[ "assert candidate([3,2,2,3], 3)==2", "assert candidate([0,1,2,2,3,0,4,2], 2)==5" ]
def test_run(content1,content2): return NLAR().new_length_removal(content1,content2)
test_run
assert candidate([["class VDPT", "def new_length_removal"]]) == 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/13
First, write a class **FMIS** using the Python language. Then, within the **FMIS** class, write a public function **find_matching_items** that, given two strings **haystack** and **needle**, finds the index of the first matching item of the **needle** string in the **haystack** string (index starts from 0). If the **ne...
[ "assert candidate(\"sadbutsad\", \"sad\")==0", "assert candidate(\"leetcode\", \"leeto\")==-1" ]
def test_run(content1,content2): return FMIS().find_matching_items(content1,content2)
test_run
assert candidate([["class FMIS", "def find_matching_items"]]) == 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/14
First, write an **LVPSS** class using the Python language. Then, within the **LVPSS** class, write a public function named **long_valid_substring**. This function should find the length of the longest valid (correctly formatted and continuous) parenthesis substring in a given string that only contains '(' and ')'.
[ "assert candidate(\"(()\")==2", "assert candidate(\"\")==0", "assert candidate(\")()())\")==4" ]
def test_run(content1): return LVPSS().long_valid_substring(content1)
test_run
assert candidate([["class LVPSS", "def long_valid_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]...