task_id
stringlengths
5
7
question
stringlengths
192
1.48k
test_list
sequencelengths
2
5
test_function
stringlengths
54
236
entry_point
stringclasses
1 value
test_matching
stringlengths
57
291
test_match_function
stringclasses
1 value
OOP/169
Question: You are to develop a gold mine. Geological surveyors have determined the resource distribution in the mine and marked it with an m*n grid. Each integer in a cell represents the amount of gold in that cell; if the cell is empty, it is 0. To maximize profits, miners need to mine gold according to the following rules: 1. Whenever a miner enters a cell, he collects all the gold in that cell. 2. Miners can move up, down, left, and right from their current position. 3. Each cell can only be mined (entered) once. 4. Cells with zero gold cannot be mined (entered). 5. Miners can start or stop from any cell with gold in the grid; Based on the above question, please use Python to create a class **RDB** with the attribute **grid**. Then create a class **SN_RDB** that inherits from the **RDB** class and add a public function **resource_distribution** that returns the result of the above question.
[ "assert candidate([[0,6,0],[5,8,7],[0,9,0]])==24", "assert candidate([[1,0,7],[2,0,6],[3,4,5],[0,3,0],[9,0,20]])==28" ]
def test_run(content1): return SN_RDB(content1).resource_distribution()
test_run
assert candidate([["class RDB", "def __init__(self, grid)", "class SN_RDB(RDB)", "super().__init__(grid)", "def resource_distribution"]]) == 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]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/170
Question: Given an integer **n**, please help to count how many strings of length **n** can be formed according to the following rules: 1. Each character in the string should be a lowercase vowel ('a', 'e', 'i', 'o', 'u'); 2. Each vowel 'a' can only be followed by 'e'; 3. Each vowel 'e' can only be followed by 'a' or 'i'; 4. Each vowel 'i' cannot be followed by another 'i'; 5. Each vowel 'o' can only be followed by 'i' or 'u'; 6. Each vowel 'u' can only be followed by 'a'; Please create a class named **FSG** in Python, with an attribute **n**; then create another class **SN_FSG** that inherits from the **FSG** class, and add a public method **Forming_String** that returns the result of the above question.
[ "assert candidate(1)==5", "assert candidate(2)==10", "assert candidate(5)==68" ]
def test_run(content1): return SN_FSG(content1).Forming_String()
test_run
assert candidate([["class FSG", "def __init__(self, n)", "class SN_FSG(FSG)", "super().__init__(n)", "def Forming_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]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/171
Question: On an 8x8 chessboard, there are several black queens and one white king. Given an array of integer coordinates **queens**, representing the positions of the black queens; and a pair of coordinates **king**, representing the position of the white king, return the coordinates of all queens that can attack the king (in any order); Based on the above question, please use python language to create a class **CKB** with the property **queens**; then create a class **SN_CKB**, inheriting from the **CKB** class, and add the property **king**, as well as a public **checkerboard** function to return the coordinates of all queens that can attack the king.
[ "assert candidate([[0,1],[1,0],[4,0],[0,4],[3,3],[2,4]],[0,0])==[[0,1],[1,0],[3,3]]", "assert candidate([[0,0],[1,1],[2,2],[3,4],[3,5],[4,4],[4,5]],[3,3])==[[2,2],[3,4],[4,4]]", "assert candidate([[5,6],[7,7],[2,1],[0,7],[1,6],[5,1],[3,7],[0,3],[4,0],[1,2],[6,3],[5,0],[0,4],[2,2],[1,1],[6,4],[5,4],[0,0],[2,6],[4,5],[5,2],[1,4],[7,5],[2,3],[0,5],[4,2],[1,0],[2,7],[0,1],[4,6],[6,1],[0,6],[4,3],[1,7]],[3,4])==[[2,3],[1,4],[1,6],[3,7],[4,3],[5,4],[4,5]]" ]
def test_run(content1,content2): return SN_CKB(content1,content2).checkerboard()
test_run
assert candidate([["class CKB", "def __init__(self, queens)", "class SN_CKB(CKB)", "def __init__(self, queens, king)", "super().__init__(queens)", "def checkerboard"]]) == 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]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/171
Create a class named **SBFD** in Python, with properties **nums**, **left**, and **right**, as well as a public function named **find_subarray**. In the public function **find_subarray**, identify and return the count of contiguous, non-empty subarrays within **nums** where the maximum element falls within the range **[left, right]**. Next, create a class named **SN_FDSB** that inherits from the **SBFD** class and add a public function named **find_subarray**. This method should return the count of elements in **nums** within the range **[left, right]**, inclusive of both **left** and **right**. If the range is empty, the function should return 0.
[ "assert candidate([2,1,4,3],2,3,1,2)==True", "assert candidate([2,9,2,5,6],2,8,1,4)==True" ]
def test_run(content1, content2, content3, res1, res2): if SBFD(content1, content2, content3).find_subarray()==res1 and SN_FDSB(content1, content2, content3).find_subarray() == res2 return True else: return False
test_run
assert candidate([["class SBFD", "def __init__(self, nums, left, right)", "class SN_FDSB", "def find_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]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/172
First, write a class named **STR** in Python, which has an instance attribute, **s**, and a public function named **without_duplicates**. In the public function **without_duplicates**, based on the instance attribute **s**, find the length of the longest substring without duplicate characters. Next, create a class named **SUB_STR** that inherits from the **STR** class and add a public function named **without_duplicates**. In the public function **without_duplicates** of the **SUB_STR** class, find the maximum distance between repeated characters in the instance attribute **s**.
[ "assert candidate(\"abcabcbb\", 3, 3)==True", "assert candidate(\"abcabcccbb\", 3, 4)==True", "assert candidate(\"pwwkeyow\", 5, 5)==True" ]
def test_run(content1, res1, res2): if STR(content1).without_duplicates()==res1 and SUB_STR(content1).without_duplicates() == res2 return True else: return False
test_run
assert candidate([["class STR", "def __init__(self, s)", "class SUB_STR", "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]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/173
Using the Python language, start by creating a class named **PLDR** with an instance attribute **number** and a public function **PLind**. Within the **PLind** function, check if a given number is a palindrome; return **True** if it is, otherwise return **False**. Next, create a subclass named **SUBPLDR** that inherits from the **PLDR** class, and introduce a public function **PLind**. In the **PLind** function of the **SUBPLDR** class, assess whether a given number is a palindrome string; return **True** if it is, otherwise return **False**.
[ "assert candidate(1211, \"abcabcbb\", False, False)==True", "assert candidate(121, \"abcabcccbb\", True, False)==True", "assert candidate(4576, \"level\", False, True)==True" ]
def test_run(content1, content2, res1, res2): if PLDR(content1).PLind()==res1 and SUBPLDR(content2).PLind() == res2 return True else: return False
test_run
assert candidate([["class PLDR", "def __init__(self, number)", "class SUBPLDR", "def PLind"]]) == 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]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/0
Question: Given an integer **n**, please find and return the n-th ugly number. Please design a **ULYNB** class in Python language based on the above question. The class should have an instance attribute **n**, a private function **private_ugly_number**, and a public function **public_ugly_number**. In the private function **private_ugly_number**, find the n-th ugly number based on the instance attribute **n**. Finally, in the public function **public_ugly_number**, call the private function **private_ugly_number** and return the result.
[ "assert candidate(10)==12", "assert candidate(1)==1" ]
def test_run(content1): return ULYNB(content1).public_ugly_number()
test_run
assert candidate([["class ULYNB", "def __init__(self, n)", "def _private_ugly_number", "def public_ugly_number"], ["class ULYNB", "def __init__(self, n)", "def __private_ugly_number", "def public_ugly_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]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/1
First, design a **NAR** class using Python language, which has instance attributes **nums**, a private function **private_Number_array**, and a public function **public_Number_array**. Then, in the private function **private_Number_array**, return the numbers in the range [0, n] that do not appear in the array **nums**. Finally, in the public function **public_Number_array**, call the private function **private_Number_array** to return the result.
[ "assert candidate([3,0,1])==2", "assert candidate([0,1])==2", "assert candidate([9,6,4,2,3,5,7,0,1])==8", "assert candidate([0])==1" ]
def test_run(content1): return NAR(content1).public_Number_array()
test_run
assert candidate([["class NAR", "def __init__(self, nums)", "def _private_Number_array","def public_Number_array"], ["class NAR", "def __init__(self, nums)", "def __private_Number_array","def public_Number_array"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/2
First, design an **ERS** class using the Python language. The class should have an instance attribute called **num**, a private function called **private_rep**, and a public function called **public_rep**. In the private function **private_rep**, convert the non-negative integer **num** into its corresponding English representation. Finally, in the public function **public_rep**, call the private function **private_rep** and return the result.
[ "assert candidate(123)==\"One Hundred Twenty Three\"", "assert candidate(12345)==\"Twelve Thousand Three Hundred Forty Five\"", "assert candidate(1234567)==\"One Million Two Hundred Thirty Four Thousand Five Hundred Sixty Seven\"" ]
def test_run(content1): return ERS(content1).public_English_representation()
test_run
assert candidate([["class ERS", "def __init__(self, num)", "def _private_rep","def public_rep"], ["class ERS", "def __init__(self, num)", "def __private_rep","def public_rep"]]) == 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]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/3
First, design a **PCT** class using the Python language. The class should have instance attribute **citations**, a private function **private_Paper_cited**, and a public function **public_Paper_cited**. In the private function **private_Paper_cited**, which takes an integer array **citations** representing the number of times the researcher's i-th paper has been cited, return the researcher's h-index. Finally, in the public function **public_Paper_cited**, call the private function **private_Paper_cited** and return the result.
[ "assert candidate([3,0,6,1,5])==3", "assert candidate([1,3,1])==1" ]
def test_run(content1): return PCT(content1).public_Paper_cited()
test_run
assert candidate([["class PCT", "def __init__(self, citations)", "def _private_Paper_cited","def public_Paper_cited"], ["class PCT", "def __init__(self, citations)", "def __private_Paper_cited","def public_Paper_cited"]]) == 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]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/4
Question: Given an integer array **citations**, where citations[i] represents the number of times the i-th paper of a researcher has been cited, and **citations** are already sorted in ascending order. Calculate and return the researcher's h-index. Please design an **AOD** class using Python language, which has an instance attribute **citations**, a private function **private_Paper_cited**, and a public function **public_ascend_order**. In the private function **private_Paper_cited**, return the researcher's h-index. Finally, in the public function **public_ascend_order**, call the private function **private_Paper_cited** and return the result.
[ "assert candidate([0,1,3,5,6])==3", "assert candidate([1,2,100])==2" ]
def test_run(content1): return AOD(content1).public_ascend_order()
test_run
assert candidate([["class AOD", "def __init__(self, citations)", "def _private_ascend_order","def public_ascend_order"], ["class AOD", "def __init__(self, citations)", "def __private_ascend_order","def public_ascend_order"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/5
First, design a class named **MQT** using the Python language. The class should have an instance attribute **n**, a private function named **private_Minimum_quantity**, and a public function named **public_Minimum_quantity**. In the private function **private_Minimum_quantity**, return the minimum number of perfect squares that add up to the integer **n**. Finally, in the public function **public_Minimum_quantity**, call the private function **private_Minimum_quantity** and return the result.
[ "assert candidate(12)==3", "assert candidate(13)==2" ]
def test_run(content1): return MQT(content1).public_Minimum_quantity()
test_run
assert candidate([["class MQT", "def __init__(self, n)", "def _private_Minimum_quantity","def public_Minimum_quantity"], ["class MQT", "def __init__(self, n)", "def __private_Minimum_quantity","def public_Minimum_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]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/6
Question: Given a string **num** that only contains digits 0-9, add binary operators (+, -, *) between the digits to form expressions. Return all the expressions that evaluate to the target integer **target**. Please design a **BOT** class in Python, which has instance attributes **num** and **target**, a private function **private_Binary_operator**, and a public function **public_Binary_operator**. The private function **private_Binary_operator** should return all the expressions that evaluate to the target integer. Finally, the public function **public_Binary_operator** should call the private function **private_Binary_operator** and return the result.
[ "assert candidate(\"123\",6)==[\"1+2+3\", \"1*2*3\"]", "assert candidate(\"232\",8)==[\"2*3+2\", \"2+3*2\"]", "assert candidate(\"3456237490\",9191)==[]" ]
def test_run(content1,content2): return BOT(content1,content2).public_Binary_operator()
test_run
assert candidate([["class BOT", "def __init__(self, num, target)", "def _private_Binary_operator","def public_Binary_operator"], ["class BOT", "def __init__(self, num, target)", "def __private_Binary_operator","def public_Binary_operator"]]) == 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]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/7
First, design a **ROE** class using the Python language. The class should have an instance attribute called **nums**, a private function called **private_relative_order**, and a public function called **public_relative_order**. In the private function **private_relative_order**, move all the zeros in the array **nums** to the end while maintaining the relative order of the non-zero elements. Finally, in the public function **public_relative_order**, call the private function **private_relative_order** and return the result.
[ "assert candidate([0,1,0,3,12])==[1,3,12,0,0]", "assert candidate([0])==[0]" ]
def test_run(content1): return ROE(content1).public_relative_order()
test_run
assert candidate([["class ROE", "def __init__(self, nums)", "def _private_relative_order","def public_relative_order"], ["class ROE", "def __init__(self, nums)", "def _private_relative_order","def public_relative_order"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/8
Question: Given an array **nums** containing n + 1 integers, where the numbers are within the range [1, n] (including 1 and n), it is known that at least one integer is duplicated. Assuming that **nums** only has one duplicated integer, return this duplicated number. Please use Python to first design a class **NDC**, with an instance attribute **nums**, a private function **private_Number_duplicates**, and a public function **public_Number_duplicates**. Then, in the private function **private_Number_duplicates**, return this duplicated number. Finally, in the public function **public_Number_duplicates**, call the private function **private_Number_duplicates** to return the result.
[ "assert candidate([1,3,4,2,2])==2", "assert candidate([3,1,3,4,2])==3" ]
def test_run(content1): return NDC(content1).public_Number_duplicates()
test_run
assert candidate([["class NDC", "def __init__(self, nums)", "def _private_Number_duplicates","def public_Number_duplicates"], ["class NDC", "def __init__(self, nums)", "def __private_Number_duplicates","def public_Number_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]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/9
Firstly, design an **LSQ** class using Python language, which has an instance attribute **nums**, a private function **private_Longest_subsequence**, and a public function **public_Longest_subsequence**. Then, in the private function **private_Longest_subsequence**, return the length of the longest strictly increasing subsequence in the instance attribute integer array **nums**. Finally, in the public function **public_Longest_subsequence**, call the private function **private_Longest_subsequence** to return the result.
[ "assert candidate([10,9,2,5,3,7,101,18])==4", "assert candidate([0,1,0,3,2,3])==4", "assert candidate([7,7,7,7,7,7,7])==1" ]
def test_run(content1): return LSQ(content1).public_Longest_subsequence()
test_run
assert candidate([["class LSQ", "def __init__(self, nums)", "def _private_Longest_subsequence","def public_Longest_subsequence"], ["class LSQ", "def __init__(self, nums)", "def __private_Longest_subsequence","def public_Longest_subsequence"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/10
Question: Given a string 's' composed of several brackets and letters, delete the minimum number of invalid brackets to make the input string valid, and return all possible results. Please use Python language to first design a 'VSR' class, with an instance attribute 's', a private function 'private_Valid_string', and a public function 'public_Valid_string'. Then, in the private function 'private_Valid_string', return all possible results of the above problem. Finally, call the private function 'private_Valid_string' in the public function 'public_Valid_string' to return the results.
[ "assert candidate(\"()())()\")==[\"(())()\",\"()()()\"]", "assert candidate(\"(a)())()\")==[\"(a())()\",\"(a)()()\"]", "assert candidate(\")(\")==[\"\"]" ]
def test_run(content1): return VSR(content1).public_Valid_string()
test_run
assert candidate([["class VSR", "def __init__(self, s)", "def _private_Valid_string","def public_Valid_string"], ["class VSR", "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]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/11
Question: An accumulative number is a string, the numbers that make up it can form an accumulative sequence. A valid accumulative sequence must contain at least 3 numbers. Except for the first two numbers, each subsequent number in the sequence must be the sum of its previous two numbers. Given a string **s** that only contains digits '0'-'9', write an algorithm to determine whether the given input is an accumulative number. If it is, return True; otherwise, return False. Please use Python language to first design an **ANB** class, which has an instance attribute **s**, a private function **private_Accumulated_number**, and a public function **public_Accumulated_number**; then in the private function **private_Accumulated_number**, determine whether the instance attribute **s** is an accumulative number, if it is, return True; otherwise, return False; finally, in the public function **public_Accumulated_number**, call the private function **private_Accumulated_number** to return the result.
[ "assert candidate(\"112358\")==True", "assert candidate(\"199100199\")==True" ]
def test_run(content1): return ANB(content1).public_Accumulated_number()
test_run
assert candidate([["class ANB", "def __init__(self, s)", "def _private_Accumulated_number","def public_Accumulated_number"], ["class ANB", "def __init__(self, s)", "def __private_Accumulated_number","def public_Accumulated_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]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/12
Firstly, design an **MCS** class using the Python language, which has an instance attribute **nums**, a private function **private_Maximum_coins**, and a public function **public_Maximum_coins**. Then, implement the following problem in the private function **private_Maximum_coins**. Finally, call the private function **private_Maximum_coins** in the public function **public_Maximum_coins** to return the result. Problem: Given **n** balloons each marked with a number from 0 to n-1, these numbers are stored in the array **nums**. You need to burst all the balloons. If you burst the i-th balloon, you can get nums[i-1]*nums[i]*nums[i+1] coins. Return the maximum number of coins that can be obtained.
[ "assert candidate([3,1,5,8])==167", "assert candidate([1,5])==10" ]
def test_run(content1): return MCS(content1).public_Maximum_coins()
test_run
assert candidate([["class MCS", "def __init__(self, nums)", "def _private_Maximum_coins","def public_Maximum_coins"], ["class MCS", "def __init__(self, nums)", "def __private_Maximum_coins","def public_Maximum_coins"]]) == 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]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/13
Firstly, design a **SNE** class using Python language, which has instance attributes **n** and **primes**, a private function **private_Super_Number**, and a public function **public_Super_Number**. Then, return the nth super ugly number in the private function **private_Super_Number**. Finally, call the private function **private_Super_Number** in the public function **public_Super_Number** to return the result.
[ "assert candidate(12,[2,7,13,19])==32", "assert candidate(1,[2,3,5])==1" ]
def test_run(content1,content2): return SNE(content1,content2).public_Super_Number()
test_run
assert candidate([["class SNE", "def __init__(self, n, primes)", "def _private_Super_Number","def public_Super_Number"], ["class SNE", "def __init__(self, n, primes)", "def __private_Super_Number","def public_Super_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]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/14
Firstly, design an **IAA** class using the Python language, which has an instance attribute **nums**, a private function **private_Integer_array**, and a public function **public_Integer_array**. Then, in the private function **private_Integer_array**, return a new array **counts** with the requirement that the value of counts[i] is the number of elements to the right of nums[i] that are less than nums[i]. Finally, call the private function **private_Integer_array** in the public function **public_Integer_array** to return the result.
[ "assert candidate([5,2,6,1])==[2,1,1,0]", "assert candidate([-1])==[0]", "assert candidate([-1,-1])==[0,0]" ]
def test_run(content1): return IAA(content1).public_Integer_array()
test_run
assert candidate([["class IAA", "def __init__(self, nums)", "def _private_Integer_array","def public_Integer_array"], ["class IAA", "def __init__(self, nums)", "def __private_Integer_array","def public_Integer_array"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/15
Firstly, design a **DMM** class using Python language, which has an instance attribute **s**, a private function **private_Dictionary_minimum**, and a public function **public_Dictionary_minimum**. Then, in the private function **private_Dictionary_minimum**, remove the duplicate letters in the string **s** so that each letter only appears once, and return the result with the smallest lexicographic order. Finally, in the public function **public_Dictionary_minimum**, call the private function **private_Dictionary_minimum** to return the result.
[ "assert candidate(\"bcabc\")==\"abc\"", "assert candidate(\"cbacdcbc\")==\"acdb\"" ]
def test_run(content1): return DMM(content1).public_Dictionary_minimum()
test_run
assert candidate([["class DMM", "def __init__(self, s)", "def _private_Dictionary_minimum","def public_Dictionary_minimum"], ["class DMM", "def __init__(self, s)", "def __private_Dictionary_minimum","def public_Dictionary_minimum"]]) == 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]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/16
Firstly, design a **CLS** class using the Python language, which has an instance attribute **words**, a private function **private_Common_letters**, and a public function **public_Common_letters**. Then, in the private function **private_Common_letters**, return the maximum value of length(words[i])*length(words[j]). Finally, in the public function **public_Common_letters**, call the private function **private_Common_letters** to return the result.
[ "assert candidate([\"abcw\",\"baz\",\"foo\",\"bar\",\"xtfn\",\"abcdef\"])==16", "assert candidate([\"a\",\"ab\",\"abc\",\"d\",\"cd\",\"bcd\",\"abcd\"])==4", "assert candidate([\"a\",\"aa\",\"aaa\",\"aaaa\"])==0" ]
def test_run(content1): return CLS(content1).public_Common_letters()
test_run
assert candidate([["class CLS", "def __init__(self, words)", "def _private_Common_letters","def public_Common_letters"], ["class CLS", "def __init__(self, words)", "def __private_Common_letters","def public_Common_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]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/17
Firstly, design a class named **ROD** using Python language, which has instance attributes **nums1**, **nums2**, and **k**, a private function **private_relative_order**, and a public function **public_relative_order**. Then, implement the following problem in the private function **private_relative_order**. Finally, call the private function **private_relative_order** in the public function **public_relative_order** to return the result. Problem: Select **k** (k<=m+n) numbers from two given arrays of length **m** and **n** respectively to form a new number. The numbers taken from the same array should maintain their relative order in the original array. Return an array of length **k** representing the maximum number.
[ "assert candidate([3, 4, 6, 5],[9, 1, 2, 5, 8, 3],5)==[9, 8, 6, 5, 3]", "assert candidate([6, 7],[6, 0, 4],5)==[6, 7, 6, 0, 4]", "assert candidate([3, 9],[8, 9],3)==[9, 8, 9]" ]
def test_run(content1,content2,content3): return ROD(content1,content2,content3).public_relative_order()
test_run
assert candidate([["class ROD", "def __init__(self, nums1, nums2, k)", "def _private_relative_order","def public_relative_order"], ["class ROD", "def __init__(self, nums1, nums2, k)", "def __private_relative_order","def public_relative_order"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/18
Firstly, design a **TAU** class using Python language, which has instance attributes **coins** and **amount**, a private function **private_Total_amount**, and a public function **public_Total_amount**. Then, in the private function **private_Total_amount**, provide an integer array **coins** representing different denominations of coins and an integer **amount** representing the total amount, and return the minimum number of coins required to make up the total amount. Finally, call the private function **private_Total_amount** in the public function **public_Total_amount** to return the result.
[ "assert candidate([1, 2, 5],11)==3", "assert candidate([2],3)==-1", "assert candidate([1],0)==0" ]
def test_run(content1,content2): return TAU(content1,content2).public_Total_amount()
test_run
assert candidate([["class TAU", "def __init__(self, coins, amount)", "def _private_Total_amount","def public_Total_amount"], ["class TAU", "def __init__(self, coins, amount)", "def __private_Total_amount","def public_Total_amount"]]) == 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]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/19
Firstly, design a **ROR** class using Python language, which has an instance attribute **nums**, a private function **private_Rearranged_order**, and a public function **public_Rearranged_order**. Then, in the private function **private_Rearranged_order**, rearrange the integer array **nums** into the order of nums[0]<nums[1]>nums[2]<nums[3]... Finally, call the private function **private_Rearranged_order** in the public function **public_Rearranged_order** to return the result.
[ "assert candidate([1,5,1,1,6,4])==[1,6,1,5,1,4]", "assert candidate([1,3,2,2,3,1])==[2,3,1,3,1,2]" ]
def test_run(content1): return ROR(content1).public_Rearranged_order()
test_run
assert candidate([["class ROR", "def __init__(self, nums)", "def _private_Rearranged_order","def public_Rearranged_order"], ["class ROR", "def __init__(self, nums)", "def __private_Rearranged_order","def public_Rearranged_order"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/20
Firstly, design an **IAN** class using the Python language, which has instance attributes **nums**, **lower**, and **upper**, a private function **private_Interval_and**, and a public function **public_Interval_and**. Then, in the private function **private_Interval_and**, return the count of interval sums within the range [lower, upper] (inclusive of **lower** and **upper**) from the integer array **nums**. Finally, in the public function **public_Interval_and**, call the private function **private_Interval_and** to return the result.
[ "assert candidate([-2,5,-1],-2,2)==3", "assert candidate([0],0,0)==1" ]
def test_run(content1,content2,content3): return IAN(content1,content2,content3).public_Interval_and()
test_run
assert candidate([["class IAN", "def __init__(self, nums, lower, upper)", "def _private_Interval_and","def public_Interval_and"], ["class IAN", "def __init__(self, nums, lower, upper)", "def __private_Interval_and","def public_Interval_and"]]) == 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]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/21
Firstly, design a class named **LIM** using Python language, which has an instance attribute **matrix**, a private function **private_Longest_Incremental**, and a public function **public_Longest_Incremental**. Then, in the private function **private_Longest_Incremental**, return the length of the longest incremental path in the given m x n integer **matrix**. Finally, call the private function **private_Longest_Incremental** in the public function **public_Longest_Incremental** to return the result.
[ "assert candidate([[9,9,4],[6,6,8],[2,1,1]])==4", "assert candidate([[3,4,5],[3,2,6],[2,2,1]])==4", "assert candidate([[1]])==1" ]
def test_run(content1): return LIM(content1).public_Longest_Incremental()
test_run
assert candidate([["class LIM", "def __init__(self, matrix)", "def _private_Longest_Incremental","def public_Longest_Incremental"], ["class LIM", "def __init__(self, matrix)", "def __private_Longest_Incremental","def public_Longest_Incremental"]]) == 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]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/22
Question: Given a sorted array of positive integers **nums**, and a positive integer **n**. Select any number from the interval [1, n] to supplement to **nums**, so that any number in the interval [1, n] can be represented by the sum of several numbers in **nums**. Please return the minimum number of numbers that need to be supplemented to meet the above requirements. Please use Python language to design an **NDT** class first, with instance attributes **nums** and **n**, a private function **private_Number_digits**, and a public function **public_Number_digits**; then return the minimum number of numbers that need to be supplemented in the private function **private_Number_digits**; finally, call the private function **private_Number_digits** in the public function **public_Number_digits** to return the result.
[ "assert candidate([1,3],6)==1", "assert candidate([1,5,10],20)==2", "assert candidate([1,2,2],5)==0" ]
def test_run(content1,content2): return NDT(content1,content2).public_Number_digits()
test_run
assert candidate([["class NDT", "def __init__(self, nums, n)", "def _private_Number_digits","def public_Number_digits"], ["class NDT", "def __init__(self, nums, n)", "def __private_Number_digits","def public_Number_digits"]]) == 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]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/23
Question: Given an integer array **nums**, determine whether there exists a length-3 increasing subsequence in this array. If there exists such a triplet index (i, j, k) and satisfies i < j < k, such that nums[i] < nums[j] < nums[k], return True; otherwise, return False. Please use Python language to first design a **LSU** class, with instance attribute **nums**, private function **private_Longest_subsequence** and public function **public_Longest_subsequence**; then in the private function **private_Longest_subsequence**, determine whether there exists a length-3 increasing subsequence in the integer array **nums**, if it exists, return True; otherwise, return False; finally, in the public function **public_Longest_subsequence**, call the private function **private_Longest_subsequence** to return the result.
[ "assert candidate([1,2,3,4,5])==True", "assert candidate([5,4,3,2,1])==False", "assert candidate([2,1,5,0,4,6])==True" ]
def test_run(content1): return LSU(content1).public_Longest_subsequence()
test_run
assert candidate([["class LSU", "def __init__(self, nums)", "def _private_Longest_subsequence","def public_Longest_subsequence"], ["class LSU", "def __init__(self, nums)", "def __private_Longest_subsequence","def public_Longest_subsequence"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/24
Firstly, design a class **CVA** using the Python language, which has an instance attribute **distance**, a private function **private_Counterclockwise_variation**, and a public function **public_Counterclockwise_variation**. Then, implement the following problem in the private function **private_Counterclockwise_variation**. Finally, call the private function **private_Counterclockwise_variation** in the public function **public_Counterclockwise_variation** to return the result. Problem: Given an integer array **distance**. Starting from the point (0,0) on the X-Y plane, each time a move is made with a counterclockwise change in direction, determine whether the path crossed. If it intersects, return True; otherwise, return False.
[ "assert candidate([2,1,1,2])==True", "assert candidate([1,2,3,4])==False", "assert candidate([1,1,1,1])==True" ]
def test_run(content1): return CVA(content1).public_Counterclockwise_variation()
test_run
assert candidate([["class CVA", "def __init__(self, distance)", "def _private_Counterclockwise_variation","def public_Counterclockwise_variation"], ["class CVA", "def __init__(self, distance)", "def __private_Counterclockwise_variation","def public_Counterclockwise_variation"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/25
Firstly, design a **USI** class using Python language, which has an instance attribute **words**, a private function **private_Unique_String**, and a public function **public_Unique_String**. Then, in the private function **private_Unique_String**, return an array of strings from **words** that satisfy the palindrome pair condition, which is composed of unique strings in a 0-indexed array. Finally, call the private function **private_Unique_String** in the public function **public_Unique_String** to return the result.
[ "assert candidate([\"abcd\",\"dcba\",\"lls\",\"s\",\"sssll\"])==[[0,1],[1,0],[3,2],[2,4]]", "assert candidate([\"bat\",\"tab\",\"cat\"])==[[0,1],[1,0]]", "assert candidate([\"a\",\"\"])==[[0,1],[1,0]]" ]
def test_run(content1): return USI(content1).public_Unique_String()
test_run
assert candidate([["class USI", "def __init__(self, words)", "def _private_Unique_String","def public_Unique_String"], ["class USI", "def __init__(self, words)", "def __private_Unique_String","def public_Unique_String"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/26
Firstly, design a **PMM** class using Python language, which has an instance attribute **n**, a private function **private_Product_maximization**, and a public function **public_Product_maximization**. Then, in the private function **private_Product_maximization**, decompose the positive integer **n** into the sum of **k** positive integers (k>=2), and maximize the product of these integers, returning the maximum product that can be obtained. Finally, call the private function **private_Product_maximization** in the public function **public_Product_maximization** to return the result.
[ "assert candidate(2)==1", "assert candidate(10)==36" ]
def test_run(content1): return PMM(content1).public_Product_maximization()
test_run
assert candidate([["class PMM", "def __init__(self, n)", "def _private_Product_maximization","def public_Product_maximization"], ["class PMM", "def __init__(self, n)", "def __private_Product_maximization","def public_Product_maximization"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/27
Firstly, design an **RSI** class using Python language, which has an instance attribute **s**, a private function **private_Result_String**, and a public function **public_Result_String**. Then, in the private function **private_Result_String**, reverse all the vowel letters in the string **s** and return the result string. Finally, in the public function **public_Result_String**, call the private function **private_Result_String** to return the result.
[ "assert candidate(\"hello\")==\"holle\"", "assert candidate(\"leetcode\")==\"leotcede\"" ]
def test_run(content1): return RSI(content1).public_Result_String()
test_run
assert candidate([["class RSI", "def __init__(self, s)", "def _private_Result_String","def public_Result_String"], ["class RSI", "def __init__(self, s)", "def __private_Result_String","def public_Result_String"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/28
Firstly, design an **AOER** class using Python language, which has instance attributes **nums** and **k**, a private function **private_Any_order**, and a public function **public_Any_order**. Then, in the private function **private_Any_order**, return the top k most frequent elements in the integer array **nums**. Finally, in the public function **public_Any_order**, call the private function **private_Any_order** to return the result.
[ "assert candidate([1,1,1,2,2,3],2)==[1,2]", "assert candidate([1],1)==[1]" ]
def test_run(content1,content2): return AOER(content1,content2).public_Any_order()
test_run
assert candidate([["class AOER", "def __init__(self, nums, k)", "def _private_Any_order","def public_Any_order"], ["class AOER", "def __init__(self, nums, k)", "def __private_Any_order","def public_Any_order"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/29
First, design a **TIE** class using the Python language, which has instance attributes **nums1** and **nums2**, a private function **private_Their_intersection**, and a public function **public_Their_intersection**. Then, in the private function **private_Their_intersection**, return the intersection between the arrays **nums1** and **nums2**. Finally, in the public function **public_Their_intersection**, call the private function **private_Their_intersection** to return the result.
[ "assert candidate([1,2,2,1],[2,2])==[2]", "assert candidate([4,9,5],[9,4,9,8,4])==[9,4]" ]
def test_run(content1,content2): return TIE(content1,content2).public_Their_intersection()
test_run
assert candidate([["class TIE", "def __init__(self, nums1, nums2)", "def _private_Their_intersection","def public_Their_intersection"], ["class TIE", "def __init__(self, nums1, nums2)", "def __private_Their_intersection","def public_Their_intersection"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/30
Question: Given two integer arrays **nums1** and **nums2**, please return the intersection of the two arrays in the form of an array. The number of times each element appears in the return result should be consistent with the number of times the element appears in both arrays (if the number of appearances is inconsistent, consider taking the smaller value). Using Python language, first design an **ORU** class, which has instance attributes **nums1** and **nums2**, a private function **private_Order_results**, and a public function **public_Order_results**. Then, implement the above problem in the private function **private_Order_results**. Finally, call the private function **private_Order_results** in the public function **public_Order_results** to return the result.
[ "assert candidate([1,2,2,1],[2,2])==[2,2]", "assert candidate([4,9,5],[9,4,9,8,4])==[4,9]" ]
def test_run(content1,content2): return ORU(content1,content2).public_Order_results()
test_run
assert candidate([["class ORU", "def __init__(self, nums1, nums2)", "def _private_Order_results","def public_Order_results"], ["class ORU", "def __init__(self, nums1, nums2)", "def __private_Order_results","def public_Order_results"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/31
Firstly, design an **RDL** class using the Python language, which has an instance attribute **envelopes**, a private function **private_Russian_dolls**, and a public function **public_Russian_dolls**. Then, implement the following problem in the private function **private_Russian_dolls**. Finally, call the private function **private_Russian_dolls** in the public function **public_Russian_dolls** to return the result. Problem: Given a two-dimensional integer array envelopes[i]=[w_i,h_i] representing the width and height of the i-th envelope, return the maximum number of envelopes that can form a set of **Russian nesting dolls**.
[ "assert candidate([[5,4],[6,4],[6,7],[2,3]])==3", "assert candidate([[1,1],[1,1],[1,1]])==1" ]
def test_run(content1): return RDL(content1).public_Russian_dolls()
test_run
assert candidate([["class RDL", "def __init__(self, envelopes)", "def _private_Russian_dolls","def public_Russian_dolls"], ["class RDL", "def __init__(self, envelopes)", "def __private_Russian_dolls","def public_Russian_dolls"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/32
Firstly, design an **NDE** class using Python language, which has an instance attribute **n**, a private function **private_Numbers_different**, and a public function **public_Numbers_different**. Then, implement the following problem in the private function **private_Numbers_different**. Finally, call the private function **private_Numbers_different** in the public function **public_Numbers_different** to return the result. Problem: Given an integer **n**, you need to return the count of numbers **x** where all digits are different, and 0<=x<10^n.
[ "assert candidate(2)==91", "assert candidate(0)==1" ]
def test_run(content1): return NDE(content1).public_Numbers_different()
test_run
assert candidate([["class NDE", "def __init__(self, n)", "def _private_Numbers_different","def public_Numbers_different"], ["class NDE", "def __init__(self, n)", "def __private_Numbers_different","def public_Numbers_different"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/33
Firstly, design a class named **MVL** using Python language, which has instance attributes **matrix** and **k**, a private function **private_Maximum_value**, and a public function **public_Maximum_value**. Then, in the private function **private_Maximum_value**, return the maximum sum of values within the rectangular area of the m x n **matrix** that does not exceed **k**. Finally, in the public function **public_Maximum_value**, call the private function **private_Maximum_value** to return the result.
[ "assert candidate([[1,0,1],[0,-2,3]],2)==2", "assert candidate([[2,2,-1]],3)==3" ]
def test_run(content1,content2): return MVL(content1,content2).public_Maximum_value()
test_run
assert candidate([["class MVL", "def __init__(self, matrix, k)", "def _private_Maximum_value","def public_Maximum_value"], ["class MVL", "def __init__(self, matrix, k)", "def __private_Maximum_value","def public_Maximum_value"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/34
Firstly, design a **DSS** class using Python language, which has an instance attribute **nums**, a private function **private_Divisible_subset**, and a public function **public_Divisible_subset**. Then, in the private function **private_Divisible_subset**, given a set **nums** composed of non-repetitive positive integers, return the largest divisible subset **answer**. Finally, in the public function **public_Divisible_subset**, call the private function **private_Divisible_subset** to return the result.
[ "assert candidate([1,2,3])==[1,2]", "assert candidate([1,2,4,8])==[1,2,4,8]" ]
def test_run(content1): return DSS(content1).public_Divisible_subset()
test_run
assert candidate([["class DSS", "def __init__(self, nums)", "def _private_Divisible_subset","def public_Divisible_subset"], ["class DSS", "def __init__(self, nums)", "def __private_Divisible_subset","def public_Divisible_subset"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/35
Question: Calculate **a^b mod 1337**, where **a** is a positive integer and **b** is a very large positive integer given in the form of an array. Use Python language to first design a **PIT** class, with instance attributes **a** and **b**, a private function **private_positive_integer**, and a public function **public_positive_integer**. Then, calculate the above problem in the private function **private_positive_integer**. Finally, call the private function **private_positive_integer** in the public function **public_positive_integer** to return the result.
[ "assert candidate(2,[3])==8", "assert candidate(2,[1,0])==1024", "assert candidate(1,[4,3,3,8,5,2])==1", "assert candidate(2147483647,[2,0,0])==1198" ]
def test_run(content1,content2): return PIT(content1,content2).public_positive_integer()
test_run
assert candidate([["class PIT", "def __init__(self, a, b)", "def _private_positive_integer","def public_positive_integer"], ["class PIT", "def __init__(self, a, b)", "def __private_positive_integer","def public_positive_integer"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/36
Question: Given two integer arrays **nums1** and **nums2** sorted in non-decreasing order, and an integer **k**. Define a pair of values (u, v), where the first element comes from **nums1** and the second element comes from **nums2**. Please find the pairs with the smallest sum (u1, v1), (u2, v2)...(uk, vk) for the first **k** pairs. Please use Python to first design a **DAG** class, with instance attributes **nums1**, **nums2** and **k**, a private function **private_decreasing_arrangement**, and a public function **public_decreasing_arrangement**. Then, implement the above problem in the private function **private_decreasing_arrangement**. Finally, call the private function **private_decreasing_arrangement** in the public function **public_decreasing_arrangement** to return the result.
[ "assert candidate([1,7,11],[2,4,6],3)==[1,2],[1,4],[1,6]", "assert candidate([1,1,2],[1,2,3],2)==[1,1],[1,1]", "assert candidate([1,2],[3],3)==[1,3],[2,3]" ]
def test_run(content1,content2,content3): return DAG(content1,content2,content3).public_decreasing_arrangement()
test_run
assert candidate([["class DAG", "def __init__(self, nums1, nums2, k)", "def _private_decreasing_arrangement","def public_decreasing_arrangement"], ["class DAG", "def __init__(self, nums1, nums2, k)", "def __private_decreasing_arrangement","def public_decreasing_arrangement"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/37
First, design an **NBGG** class using the Python language, which has an instance attribute **n**, a private function **private_Guessing_Game**, and a public function **public_Guessing_Game**. Then, call the private function **private_ugly_number** in the public function **public_Guessing_Game** to return the result. The following problem is implemented in the private function **private_Guessing_Game**. Problem: Choose a number between 1 and **n** for a guessing game. If you guess the correct number, you win the game; otherwise, you will be told that the current number I chose is larger or smaller, and you continue to guess. When you guess the number **x** and get it wrong, you need to pay cash equal to **x**. If you run out of money, you lose the game. Given a specific number **n**, return the minimum amount of cash that can ensure victory.
[ "assert candidate(10)==16", "assert candidate(1)==0", "assert candidate(2)==1" ]
def test_run(content1): return NBGG(content1).public_Guessing_Game()
test_run
assert candidate([["class NBGG", "def __init__(self, n)", "def _private_Guessing_Game","def public_Guessing_Game"], ["class NBGG", "def __init__(self, n)", "def __private_Guessing_Game","def public_Guessing_Game"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/38
Firstly, design an **LSS** class using Python language, which has an instance attribute **nums**, a private function **private_Longest_subsequence**, and a public function **public_Longest_subsequence**. Then, in the private function **private_Longest_subsequence**, return the length of the longest subsequence in the integer array **nums** that serves as a wiggle sequence. Finally, in the public function **public_Longest_subsequence**, call the private function **private_Longest_subsequence** to return the result.
[ "assert candidate([1,7,4,9,2,5])==6", "assert candidate([1,17,5,10,13,15,10,5,16,8])==7", "assert candidate([1,2,3,4,5,6,7,8,9])==2" ]
def test_run(content1): return LSS(content1).public_Longest_subsequence()
test_run
assert candidate([["class LSS", "def __init__(self, nums)", "def _private_Longest_subsequence","def public_Longest_subsequence"], ["class LSS", "def __init__(self, nums)", "def __private_Longest_subsequence","def public_Longest_subsequence"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/39
Question: Given an array **nums** composed of distinct integers and a target integer **target**, please find and return the number of combinations in **nums** that sum up to **target**. Please use Python language to first design an **EAC** class, with instance attributes **nums** and **target**, a private function **private_element_association**, and a public function **public_element_association**. Then, implement the above problem in the private function **private_element_association**. Finally, call the private function **private_element_association** in the public function **public_element_association** to return the result.
[ "assert candidate([1,2,3],4)==7", "assert candidate([9],3)==0" ]
def test_run(content1,content2): return EAC(content1,content2).public_element_association()
test_run
assert candidate([["class EAC", "def __init__(self, nums, target)", "def _private_element_association","def public_element_association"], ["class EAC", "def __init__(self, nums, target)", "def __private_element_association","def public_element_association"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/40
Question: Given an n x n matrix **matrix**, where each row and column elements are sorted in ascending order, find the k-th smallest element in the matrix. Please use Python to first design a **SAS** class, with instance attributes **matrix** and **k**, a private function **private_Sort_ascending**, and a public function **public_Sort_ascending**. Then, implement the above problem in the private function **private_Sort_ascending**. Finally, call the private function **private_Sort_ascending** in the public function **public_Sort_ascending** to return the result.
[ "assert candidate([[1,5,9],[10,11,13],[12,13,15]],8)==13", "assert candidate([[-5]],1)==-5" ]
def test_run(content1,content2): return SAS(content1,content2).public_Sort_ascending()
test_run
assert candidate([["class SAS", "def __init__(self, matrix, k)", "def _private_Sort_ascending","def public_Sort_ascending"], ["class SAS", "def __init__(self, matrix, k)", "def __private_Sort_ascending","def public_Sort_ascending"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/41
Question: Given a string **s** representing a **NestedInteger** of integers, implement a parser to parse it and return the parsed result as **NestedInteger**. Please use Python to first design an **INT** class, which has an instance attribute **s**, a private function **private_Integer_nesting**, and a public function **public_Integer_nesting**. Then, implement the above problem in the private function **private_Integer_nesting**. Finally, call the private function **private_Integer_nesting** in the public function **public_Integer_nesting** to return the result.
[ "assert candidate(\"324\")==324", "assert candidate(\"[123,[456,[789]]]\")==[123,[456,[789]]]" ]
def test_run(content1): return INT(content1).public_Integer_nesting()
test_run
assert candidate([["class INT", "def __init__(self, s)", "def _private_Integer_nesting","def public_Integer_nesting"], ["class INT", "def __init__(self, s)", "def _private_Integer_nesting","def public_Integer_nesting"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/42
Firstly, design a class named **DOD** using Python language, which has an instance attribute **n**, a private function **private_Dictionary_order**, and a public function **public_Dictionary_order**. Then, in the private function **private_Dictionary_order**, return all integers within the range [1, n] in dictionary order. Finally, in the public function **public_Dictionary_order**, call the private function **private_Dictionary_order** to return the result.
[ "assert candidate(13)==[1,10,11,12,13,2,3,4,5,6,7,8,9]", "assert candidate(2)==[1,2]" ]
def test_run(content1): return DOD(content1).public_Dictionary_order()
test_run
assert candidate([["class DOD", "def __init__(self, n)", "def _private_Dictionary_order","def public_Dictionary_order"], ["class DOD", "def __init__(self, n)", "def __private_Dictionary_order","def public_Dictionary_order"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/43
Question: Given two strings **s** and **t**, they only contain lowercase letters. String **t** is randomly rearranged from string **s**, and then a letter is added at a random position. Please find the letter added in **t**. Please use Python language to first design a **RAI** class, with instance attributes **s** and **t**, a private function **private_Random_addition**, and a public function **public_Random_addition**; then implement the above problem in the private function **private_Random_addition**; finally, call the private function **private_Random_addition** in the public function **public_Random_addition** to return the result.
[ "assert candidate(\"abcd\",\"abcde\")==\"e\"", "assert candidate(\"\",\"y\")==\"y\"" ]
def test_run(content1,content2): return RAI(content1,content2).public_Random_addition()
test_run
assert candidate([["class RAI", "def __init__(self, s, t)", "def _private_Random_addition","def public_Random_addition"], ["class RAI", "def __init__(self, s, t)", "def __private_Random_addition","def public_Random_addition"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/44
Firstly, design an **RNE** class using Python language, which has an instance attribute **n**, a private function **private_remaining_numbers**, and a public function **public_remaining_numbers**. Then, implement the following problem in the private function **private_remaining_numbers**. Finally, call the private function **private_remaining_numbers** in the public function **public_remaining_numbers** to return the result. Problem: The given list **arr** consists of all integers in the range [1, n] and is strictly sorted in ascending order. You need to delete the first number of **arr** from left to right, then delete a number every other number until you reach the end of the list, then repeat the above steps from right to left. Keep repeating these two steps until only one number is left. Given an integer **n**, you are required to return the last remaining number in **arr**.
[ "assert candidate(9)==6", "assert candidate(1)==1" ]
def test_run(content1): return RNE(content1).public_remaining_numbers()
test_run
assert candidate([["class RNE", "def __init__(self, n)", "def _private_remaining_numbers","def public_remaining_numbers"], ["class RNE", "def __init__(self, n)", "def __private_remaining_numbers","def public_remaining_numbers"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/45
Firstly, design a **PCN** class using Python language, which has an instance attribute **rectangles**, a private function **private_Parallel_coordinate**, and a public function **public_Parallel_coordinate**. Then, implement the following problem in the private function **private_Parallel_coordinate**. Finally, call the private function **private_Parallel_coordinate** in the public function **public_Parallel_coordinate** to return the result. Problem: Given an array rectangles[i] = [x_i, y_i, a_i, b_i] representing a rectangle parallel to the coordinate axis, where the lower left vertex is (x_i, y_i) and the upper right vertex is (a_i, b_i), determine whether all rectangles together exactly cover a certain rectangular area. If so, return **True**; otherwise, return **False**.
[ "assert candidate([[1,1,3,3],[3,1,4,2],[3,2,4,4],[1,3,2,4],[2,3,3,4]])==True", "assert candidate([[1,1,2,3],[1,3,2,4],[3,1,4,2],[3,2,4,4]])==False", "assert candidate([[1,1,3,3],[3,1,4,2],[1,3,2,4],[2,2,4,4]])==False" ]
def test_run(content1): return PCN(content1).public_Parallel_coordinate()
test_run
assert candidate([["class PCN", "def __init__(self, rectangles)", "def _private_Parallel_coordinate","def public_Parallel_coordinate"], ["class PCN", "def __init__(self, rectangles)", "def __private_Parallel_coordinate","def public_Parallel_coordinate"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/46
Firstly, design a **VED** class using Python language, which has an instance attribute **data**, a private function **private_Valid_encoding**, and a public function **public_Valid_encoding**. Then, implement the following problem in the private function **private_Valid_encoding**. Finally, call the private function **private_Valid_encoding** in the public function **public_Valid_encoding** to return the result. Problem: Given an integer array **data** representing data, return whether it is a valid UTF-8 encoding. Characters in UTF-8 need to follow the following rules: For a 1-byte character, the first bit of the byte is set to 0, and the following 7 bits are the unicode code of this symbol. For an n-byte character (n>1), the first n bits of the first byte are all set to 1, the n+1 bit is set to 0, and the first two bits of the following bytes are all set to 10. The remaining unmentioned binary bits are all the unicode code of this symbol.
[ "assert candidate([197,130,1])==True", "assert candidate([235,140,4])==False" ]
def test_run(content1): return VED(content1).public_Valid_encoding()
test_run
assert candidate([["class VED", "def __init__(self, data)", "def _private_Valid_encoding","def public_Valid_encoding"], ["class VED", "def __init__(self, data)", "def __private_Valid_encoding","def public_Valid_encoding"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/47
Firstly, design a class **LST** using the Python language, which has instance attributes **s** and **k**, a private function **private_Longest_substring**, and a public function **public_Longest_substring**. Then, in the private function **private_Longest_substring**, return the length of the longest substring in the string **s** where each character appears no less than **k** times. Finally, in the public function **public_Longest_substring**, call the private function **private_Longest_substring** to return the result.
[ "assert candidate(\"aaabb\",3)==3", "assert candidate(\"ababbc\",2)==5" ]
def test_run(content1,content2): return LST(content1,content2).public_Longest_substring()
test_run
assert candidate([["class LST", "def __init__(self, s, k)", "def _private_Longest_substring","def public_Longest_substring"], ["class LST", "def __init__(self, s, k)", "def __private_Longest_substring","def public_Longest_substring"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/48
Firstly, design a **CRT** class using Python language, which has an instance attribute **nums**, a private function **private_clockwise_rotation**, and a public function **public_clockwise_rotation**. Then, implement the following problem in the private function **private_clockwise_rotation**. Finally, call the private function **private_clockwise_rotation** in the public function **public_clockwise_rotation** to return the result. Problem: Suppose **arrk** is the array after the integer array **nums** of length **n** is rotated **k** positions clockwise, we define the rotation function **F** of **nums** as: F(k)=0*arrk[0]+1*arrk[1]+...+(n-1)*arrk[n-1]. You need to return the maximum value among F(0), F(1), ..., F(n-1).
[ "assert candidate([4,3,2,6])==26", "assert candidate([100])==0" ]
def test_run(content1): return CRT(content1).public_clockwise_rotation()
test_run
assert candidate([["class CRT", "def __init__(self, nums)", "def _private_clockwise_rotation","def public_clockwise_rotation"], ["class CRT", "def __init__(self, nums)", "def __private_clockwise_rotation","def public_clockwise_rotation"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/49
Firstly, design an **MRC** class using Python language, which has an instance attribute **n**, a private function **private_Minimum_replacements**, and a public function **public_Minimum_replacements**. Then, in the private function **private_Minimum_replacements**, given a positive integer **n**, if **n** is even, replace **n** with **n/2**. If **n** is odd, replace **n** with **n+1** or **n-1**. Return the minimum number of replacements required for **n** to become 1. Finally, in the public function **public_Minimum_replacements**, call the private function **private_Minimum_replacements** to return the result.
[ "assert candidate(8)==3", "assert candidate(7)==4", "assert candidate(4)==2" ]
def test_run(content1): return MRC(content1).public_Minimum_replacements()
test_run
assert candidate([["class MRC", "def __init__(self, n)", "def _private_Minimum_replacements","def public_Minimum_replacements"], ["class MRC", "def __init__(self, n)", "def __private_Minimum_replacements","def public_Minimum_replacements"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/50
Firstly, design an **IIG** class using Python language, which has an instance attribute **n**, a private function **private_Infinite_integers**, and a public function **public_Infinite_integers**. Then, in the private function **private_Infinite_integers**, return the number at the n-th position in the infinite integer sequence [1,2,3,4,5,6,7,8,9,10,11,...]. Finally, call the private function **private_Infinite_integers** in the public function **public_Infinite_integers** to return the result.
[ "assert candidate(3)==3", "assert candidate(11)==0" ]
def test_run(content1): return IIG(content1).public_Infinite_integers()
test_run
assert candidate([["class IIG", "def __init__(self, n)", "def _private_Infinite_integers","def public_Infinite_integers"], ["class IIG", "def __init__(self, n)", "def __private_Infinite_integers","def public_Infinite_integers"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/51
Question: Given a non-negative integer **num** represented as a string and an integer **k**, remove **k** digits from the number so that the remaining number is the smallest. Please return this smallest number in string form. Using Python, first design a **SNU** class, which has instance attributes **num** and **k**, a private function **private_smallest_number**, and a public function **public_smallest_number**. Then implement the above problem in the private function **private_smallest_number**. Finally, call the private function **private_smallest_number** in the public function **public_smallest_number** to return the result.
[ "assert candidate(\"1432219\",3)==\"1219\"", "assert candidate(\"10200\",1)==\"200\"", "assert candidate(\"10\",2)==\"0\"" ]
def test_run(content1,content2): return SNU(content1,content2).public_smallest_number()
test_run
assert candidate([["class SNU", "def __init__(self, num, k)", "def _private_smallest_number","def public_smallest_number"], ["class SNU", "def __init__(self, num, k)", "def __private_smallest_number","def public_smallest_number"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/52
First, design an **RQU** class using the Python language, which has an instance attribute **people**, a private function **private_Rank_queue**, and a public function **public_Rank_queue**. Then, implement the following problem in the private function **private_Rank_queue**. Finally, call the private function **private_Rank_queue** in the public function **public_Rank_queue** to return the result. Problem: Assume there is a group of people standing in a queue in a disordered order. The array **people[i]=[h_i,k_i]** indicates that the height of the i-th person is **h_i**, and there are exactly **k_i** people in front of him who are taller or equal to **h_i**. The requirement is to return the queue represented by the input array **people**.
[ "assert candidate([[7,0],[4,4],[7,1],[5,0],[6,1],[5,2]])==[[5,0],[7,0],[5,2],[6,1],[4,4],[7,1]]", "assert candidate([[6,0],[5,0],[4,0],[3,2],[2,2],[1,4]])==[[4,0],[5,0],[2,2],[3,2],[1,4],[6,0]]" ]
def test_run(content1): return RQU(content1).public_Rank_queue()
test_run
assert candidate([["class RQU", "def __init__(self, people)", "def _private_Rank_queue","def public_Rank_queue"], ["class RQU", "def __init__(self, people)", "def __private_Rank_queue","def public_Rank_queue"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/53
Question: Given a non-negative integer array **nums** and an integer **m**, you need to divide this array into **m** non-empty continuous subarrays. Design an algorithm to make the maximum value of the sum of these **m** subarrays the smallest. Please use Python language to first design a **CSR** class, with instance attributes **nums** and **m**, a private function **private_Continuous_subarray**, and a public function **public_Continuous_subarray**; then implement the above problem in the private function **private_Continuous_subarray**; finally, call the private function **private_Continuous_subarray** in the public function **public_Continuous_subarray** to return the result.
[ "assert candidate([7,2,5,10,8],2)==18", "assert candidate([1,2,3,4,5],2)==9", "assert candidate([1,4,4],3)==4" ]
def test_run(content1,content2): return CSR(content1,content2).public_Continuous_subarray()
test_run
assert candidate([["class CSR", "def __init__(self, nums, m)", "def _private_Continuous_subarray","def public_Continuous_subarray"], ["class CSR", "def __init__(self, nums, m)", "def __private_Continuous_subarray","def public_Continuous_subarray"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/54
Firstly, design an **EAY** class using the Python language, which has an instance attribute **nums**, a private function **private_Equidistant_array**, and a public function **public_Equidistant_array**. Then, in the private function **private_Equidistant_array**, provide an integer array **nums** and return the number of sub-arrays in **nums** that are arithmetic arrays. Finally, in the public function **public_Equidistant_array**, call the private function **private_Equidistant_array** to return the result.
[ "assert candidate([1,2,3,4])==3", "assert candidate([1])==0" ]
def test_run(content1): return EAY(content1).public_Equidistant_array()
test_run
assert candidate([["class EAY", "def __init__(self, nums)", "def _private_Equidistant_array","def public_Equidistant_array"], ["class EAY", "def __init__(self, nums)", "def __private_Equidistant_array","def public_Equidistant_array"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/55
Firstly, design an **SSB** class using the Python language, which has an instance attribute **nums**, a private function **private_split_subset**, and a public function **public_split_subset**. Then, in the private function **private_split_subset**, determine whether the non-empty array **nums**, which only contains positive integers, can be split into two subsets so that the sum of the elements in the two subsets is equal. Finally, in the public function **public_split_subset**, call the private function **private_split_subset** to return the result.
[ "assert candidate([1,5,11,5])==True", "assert candidate([1,2,3,5])==False" ]
def test_run(content1): return SSB(content1).public_split_subset()
test_run
assert candidate([["class SSB", "def __init__(self, nums)", "def _private_split_subset","def public_split_subset"], ["class SSB", "def __init__(self, nums)", "def __private_split_subset","def public_split_subset"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/56
Question: Given a m x n matrix **board** representing a deck, where each cell can be a battleship 'X' or an empty spot '.', return the number of battleships placed on the board. Please use Python to first design a **PBI** class, with an instance attribute **board**, a private function **private_Placed_battleships**, and a public function **public_Placed_battleships**. Then implement the above problem in the private function **private_Placed_battleships**. Finally, call the private function **private_Placed_battleships** in the public function **public_Placed_battleships** to return the result.
[ "assert candidate([[\"X\",\".\",\".\",\"X\"],[\".\",\".\",\".\",\"X\"],[\".\",\".\",\".\",\"X\"]])==2", "assert candidate([[\".\"]])==0" ]
def test_run(content1): return PBI(content1).","()
test_run
assert candidate([["class PBI", "def __init__(self, board)", "def _private_Placed_battleships","def public_Placed_battleships"], ["class PBI", "def __init__(self, board)", "def __private_Placed_battleships","def public_Placed_battleships"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/57
First, design an **MRU** class using the Python language, which has an instance attribute **nums**, a private function **private_Maximum_result**, and a public function **public_Maximum_result**. Then, in the private function **private_Maximum_result**, return the maximum operation result of nums[i] XOR nums[j], where 0≤i≤j<n. Finally, in the public function **public_Maximum_result**, call the private function **private_Maximum_result** to return the result.
[ "assert candidate([3,10,5,25,2,8])==28", "assert candidate([14,70,53,83,49,91,36,80,92,51,66,70])==127" ]
def test_run(content1): return MRU(content1).public_Maximum_result()
test_run
assert candidate([["class MRU", "def __init__(self, nums)", "def _private_Maximum_result","def public_Maximum_result"], ["class MRU", "def __init__(self, nums)", "def __private_Maximum_result","def public_Maximum_result"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/58
Question: Given a string **s**, which contains several numbers (0-9) represented by scrambled English words, return the original numbers in ascending order. Using Python language, first design a **DOR** class, with instance attribute **s**, private function **private_Disordered_order** and public function **public_Disordered_order**; then implement the above problem in the private function **private_Disordered_order**; finally, call the private function **private_Disordered_order** in the public function **public_Disordered_order** to return the result.
[ "assert candidate(\"owoztneoer\")==\"012\"", "assert candidate(\"fviefuro\")==\"45\"" ]
def test_run(content1): return DOR(content1).public_Disordered_order()
test_run
assert candidate([["class DOR", "def __init__(self, s)", "def _private_Disordered_order","def public_Disordered_order"], ["class DOR", "def __init__(self, s)", "def __private_Disordered_order","def public_Disordered_order"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/59
Firstly, design an **LSR** class using Python language, which has instance attributes **s** and **k**, a private function **private_Longest_substring**, and a public function **public_Longest_substring**. Then, in the private function **private_Longest_substring**, change any character in the string **s** to any other uppercase English character up to **k** times, and return the length of the longest substring containing the same letter. Finally, in the public function **public_Longest_substring**, call the private function **private_Longest_substring** to return the result.
[ "assert candidate(\"ABAB\",2)==4", "assert candidate(\"AABABBA\",1)==4" ]
def test_run(content1,content2): return LSR(content1,content2).public_Longest_substring()
test_run
assert candidate([["class LSR", "def __init__(self, s, k)", "def _private_Longest_substring","def public_Longest_substring"], ["class LSR", "def __init__(self, s, k)", "def _private_Longest_substring","def public_Longest_substring"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/60
Firstly, design a class **GS** using Python language, which has instance attributes **start**, **end**, and **bank**, a private function **private_gene_sequence**, and a public function **public_gene_sequence**. Then, implement the following problem in the private function **private_gene_sequence**. Finally, call the private function **private_gene_sequence** in the public function **public_gene_sequence** to return the result. Problem: A gene sequence is represented by a string composed of 8 characters, each of which is one of 'A', 'C', 'G', and 'T'. Suppose we need to investigate the gene changes that occur when the gene sequence **start** changes to **end**. Gene changes mean that the characters have changed. Given a gene bank **bank** that records all valid gene changes, return the minimum number of changes required to change **start** to **end**. If this gene change cannot be completed, return -1.
[ "assert candidate(\"AACCGGTT\", \"AACCGGTA\", [\"AACCGGTA\"])==1", "assert candidate(\"AACCGGTT\", \"AAACGGTA\", [\"AACCGGTA\",\"AACCGCTA\",\"AAACGGTA\"])==2", "assert candidate(\"AAAAACCC\", \"AACCCCCC\", [\"AAAACCCC\",\"AAACCCCC\",\"AACCCCCC\"])==3" ]
def test_run(content1,content2,content3): return GS(content1,content2,content3).public_gene_sequence()
test_run
assert candidate([["class GS", "def __init__(self, start, end, bank)", "def _private_gene_sequence","def public_gene_sequence"], ["class GS", "def __init__(self, start, end, bank)", "def __private_gene_sequence","def public_gene_sequence"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/61
Question: Given a collection of **intervals** where intervals[i] = [start_i, end_i]. Return the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping. Please use Python to first design a **SIL** class, with instance attribute **intervals**, a private function **private_Set_intervals**, and a public function **public_Set_intervals**. Then, implement the above problem in the private function **private_Set_intervals**. Finally, call the private function **private_Set_intervals** in the public function **public_Set_intervals** to return the result.
[ "assert candidate([[1,2],[2,3],[3,4],[1,3]])==1", "assert candidate([[1,2], [1,2], [1,2]])==2", "assert candidate([[1,2], [2,3]])==0" ]
def test_run(content1): return SIL(content1).public_Set_intervals()
test_run
assert candidate([["class SIL", "def __init__(self, intervals)", "def _private_Set_intervals","def public_Set_intervals"], ["class SIL", "def __init__(self, intervals)", "def __private_Set_intervals","def public_Set_intervals"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/62
Firstly, design an **RSC** class using Python language, which has an instance attribute **intervals**, a private function **private_Right_section**, and a public function **public_Right_section**. Then, implement the following problem in the private function **private_Right_section**. Finally, call the private function **private_Right_section** in the public function **public_Right_section** to return the result. Problem: Given an interval array **intervals**, where intervals[i] = [start_i, end_i], and each **start_i** is different. The right section of interval **i** can be denoted as interval **j**, satisfying **start_j >= end_i**, and **start_j** is minimized. Return an array composed of the indices of the right section of each interval **i** in **intervals**. If there is no corresponding right section for a certain interval **i**, the value at index **i** is set to -1.
[ "assert candidate([[1,2]])==[-1]", "assert candidate([[3,4],[2,3],[1,2]])==[-1,0,1]", "assert candidate([[1,4],[2,3],[3,4]])==[-1,2,-1]" ]
def test_run(content1): return RSC(content1).public_Right_section()
test_run
assert candidate([["class RSC", "def __init__(self, intervals)", "def _private_Right_section","def public_Right_section"], ["class RSC", "def __init__(self, intervals)", "def __private_Right_section","def public_Right_section"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/63
Question: Given two strings **s** and **p**, find all the anagrams of **p** in **s**, and return the starting indices of these substrings. An anagram is a string formed by rearranging the same letters (including the same string). Please use Python to first design a **SIN** class, with instance attributes **s** and **p**, a private function **private_start_index**, and a public function **public_start_index**; then implement the above problem in the private function **private_start_index**; finally, call the private function **private_start_index** in the public function **public_start_index** to return the result.
[ "assert candidate(\"cbaebabacd\",\"abc\")==[0,6]", "assert candidate(\"abab\",\"ab\")==[0,1,2]" ]
def test_run(content1,content2): return SIN(content1,content2).public_start_index()
test_run
assert candidate([["class SIN", "def __init__(self, s, p)", "def _private_start_index","def public_start_index"], ["class SIN", "def __init__(self, s, p)", "def __private_start_index","def public_start_index"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/64
Firstly, design a **DOE** class using Python language, which has instance attributes **n** and **k**, a private function **private_Dictionary_order**, and a public function **public_Dictionary_order**. Then, return the **k-th** smallest number in the dictionary order of [1, n] in the private function **private_Dictionary_order**. Finally, call the private function **private_Dictionary_order** in the public function **public_Dictionary_order** to return the result.
[ "assert candidate(13,2)==10", "assert candidate(1,1)==1" ]
def test_run(content1,content2): return DOE(content1,content2).public_Dictionary_order()
test_run
assert candidate([["class DOE", "def __init__(self, n, k)", "def _private_Dictionary_order","def public_Dictionary_order"], ["class DOE", "def __init__(self, n, k)", "def __private_Dictionary_order","def public_Dictionary_order"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/65
Question: There are a total of **n** coins, and the plan is to arrange them in a staircase shape. For a staircase composed of **k** rows, the i-th row must have exactly **i** coins. The last row of the staircase may be incomplete. Given a number **n**, calculate and return the total number of rows that can form a complete staircase. Please use the Python language to first design a **CLA** class, with an instance attribute **n**, a private function **private_Complete_ladder**, and a public function **public_Complete_ladder**; then implement the above problem in the private function **private_Complete_ladder**; finally, call the private function **private_Complete_ladder** in the public function **public_Complete_ladder** to return the result.
[ "assert candidate(5)==2", "assert candidate(8)==3" ]
def test_run(content1): return CLA(content1).public_Complete_ladder()
test_run
assert candidate([["class CLA", "def __init__(self, n)", "def _private_Complete_ladder","def public_Complete_ladder"], ["class CLA", "def __init__(self, n)", "def __private_Complete_ladder","def public_Complete_ladder"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/66
Question: Given an integer array **nums** of length **n**, where all integers in **nums** are within the range [1, n] and each integer appears once or twice. Please find all integers that appear twice and return them in the form of an array. Please use Python to first design a class **AFO** with instance attribute **nums**, private function **private_Array_form** and public function **public_Array_form**; then implement the above problem in the private function **private_Array_form**; finally, call the private function **private_Array_form** in the public function **public_Array_form** to return the result.
[ "assert candidate([4,3,2,7,8,2,3,1])==[2,3]", "assert candidate([1,1,2])==[1]", "assert candidate([1])==[]" ]
def test_run(content1): return AFO(content1).public_Array_form()
test_run
assert candidate([["class AFO", "def __init__(self, nums)", "def _private_Array_form","def public_Array_form"], ["class AFO", "def __init__(self, nums)", "def __private_Array_form","def public_Array_form"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/67
Firstly, design an **ISAR** class using the Python language, which has instance attributes **chars**, a private function **private_Input_sarray**, and a public function **public_Input_sarray**. Then, implement the following problem in the private function **private_Input_sarray**. Finally, call the private function **private_Input_sarray** in the public function **public_Input_sarray** to return the result. Problem: Given a character array **chars**, compress the array according to the following requirements: Starting from an empty string **s**, for each group of consecutive repeating characters in **chars**, if the length of the group is 1, append the character to **s**. Otherwise, append the character to **s**, followed by the length of the group. The requirement is to return the new length of the array after modifying the input array.
[ "assert candidate([\"a\",\"a\",\"b\",\"b\",\"c\",\"c\",\"c\"])==[\"a\",\"2\",\"b\",\"2\",\"c\",\"3\"]", "assert candidate([\"a\"])==[\"a\"]", "assert candidate([\"a\",\"b\",\"b\",\"b\",\"b\",\"b\",\"b\",\"b\",\"b\",\"b\",\"b\",\"b\",\"b\"])==[\"a\",\"b\",\"1\",\"2\"]" ]
def test_run(content1): return ISAR(content1).public_Input_sarray()
test_run
assert candidate([["class ISAR", "def __init__(self, chars)", "def _private_Input_sarray","def public_Input_sarray"], ["class ISAR", "def __init__(self, chars)", "def __private_Input_sarray","def public_Input_sarray"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/68
Firstly, design an **ESQ** class using Python language, which has an instance attribute **nums**, a private function **private_Equidistant_subsequence**, and a public function **public_Equidistant_subsequence**. Then, in the private function **private_Equidistant_subsequence**, return the number of all equidistant subsequences in the integer array **nums**. Finally, in the public function **public_Equidistant_subsequence**, call the private function **private_Equidistant_subsequence** to return the result.
[ "assert candidate([2,4,6,8,10])==7", "assert candidate([7,7,7,7,7])==16" ]
def test_run(content1): return ESQ(content1).public_Equidistant_subsequence()
test_run
assert candidate([["class ESQ", "def __init__(self, nums)", "def _private_Equidistant_subsequence","def public_Equidistant_subsequence"], ["class ESQ", "def __init__(self, nums)", "def __private_Equidistant_subsequence","def public_Equidistant_subsequence"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/69
Firstly, design an **EDA** class using Python language, which has an instance attribute **points**, a private function **private_Euclidean_distance**, and a public function **public_Euclidean_distance**. Then, implement the following problem in the private function **private_Euclidean_distance**. Finally, call the private function **private_Euclidean_distance** in the public function **public_Euclidean_distance** to return the result. Problem: Given **n** pairs of distinct points on the plane points[i]=[x_i,y_i], a point (i,j,k) represents a boomerang, where the distance between **i** and **j** is equal to the Euclidean distance between **i** and **k** (considering the order of the tuple), return the number of all boomerangs on the plane.
[ "assert candidate([[0,0],[1,0],[2,0]])==2", "assert candidate([[1,1],[2,2],[3,3]])==2", "assert candidate([[1,1]])==0" ]
def test_run(content1): return EDA(content1).public_Euclidean_distance()
test_run
assert candidate([["class EDA", "def __init__(self, points)", "def _private_Euclidean_distance","def public_Euclidean_distance"], ["class EDA", "def __init__(self, points)", "def __private_Euclidean_distance","def public_Euclidean_distance"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/70
Question: Given a string **s**, sort it in decreasing order based on the frequency of characters. The frequency of a character is the number of times it appears in the string. Return the sorted string. Please use Python to first design a **DODE** class, with an instance attribute **s**, a private function **private_descending_order**, and a public function **public_descending_order**; then implement the above problem in the private function **private_descending_order**; finally, call the private function **private_descending_order** in the public function **public_descending_order** to return the result.
[ "assert candidate(\"tree\")==\"eert\"", "assert candidate(\"cccaaa\")==\"cccaaa\"", "assert candidate(\"Aabb\")==\"bbAa\"" ]
def test_run(content1): return DODE(content1).public_descending_order()
test_run
assert candidate([["class DODE", "def __init__(self, s)", "def _private_descending_order","def public_descending_order"], ["class DODE", "def __init__(self, s)", "def __private_descending_order","def public_descending_order"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/71
Question: Given an integer array of length n, each operation will increase n - 1 elements by 1. Return the minimum number of operations to make all elements in the array equal. Please design an **EEL** class in Python first, with instance attribute **nums**, a private function **private_Element_equality**, and a public function **public_Element_equality**. Then, implement the above problem in the private function **private_Element_equality**. Finally, call the private function **private_Element_equality** in the public function **public_Element_equality** to return the result.
[ "assert candidate([1,2,3])==3", "assert candidate([1,1,1])==0" ]
def test_run(content1): return EEL(content1).public_Element_equality()
test_run
assert candidate([["class EEL", "def __init__(self, nums)", "def _private_Element_equality","def public_Element_equality"], ["class EEL", "def __init__(self, nums)", "def __private_Element_equality","def public_Element_equality"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/72
Question: Given four integer arrays **nums1**, **nums2**, **nums3**, and **nums4**, all of the same length **n**, calculate how many tuples (i, j, k, l) can satisfy: 0 <= i, j, k, l < n and nums1[i] + nums2[j] + nums3[k] + nums4[l] == 0. Please use Python to first design an **AST** class, with instance attributes **nums1**, **nums2**, **nums3**, and **nums4**, a private function **private_Array_stlength**, and a public function **public_Array_stlength**. Then, implement the above problem in the private function **private_Array_stlength**. Finally, call the private function **private_Array_stlength** in the public function **public_Array_stlength** to return the result.
[ "assert candidate([1,2],[-2,-1],[-1,2],[0,2])==2", "assert candidate([0],[0],[0],[0])==1" ]
def test_run(content1,content2,content3,content4): return AST(content1,content2,content3,content4).public_Array_stlength()
test_run
assert candidate([["class AST", "def __init__(self, nums1, nums2, nums3, nums4)", "def _private_Array_stlength","def public_Array_stlength"], ["class AST", "def __init__(self, nums1, nums2, nums3, nums4)", "def __private_Array_stlength","def public_Array_stlength"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/73
Question: Given an integer array **nums** with **n** integers. A 132 pattern subsequence is a three-element sequence nums[i], nums[j], and nums[k] that satisfies: i<j<k and nums[i]<nums[k]<nums[j]. If there is a 132 pattern subsequence in **nums**, return True; otherwise, return False. Please design a **SPAR** class in Python first, with an instance attribute **nums**, a private function **private_Subsequences_patterns**, and a public function **public_Subsequences_patterns**; then implement the above problem in the private function **private_Subsequences_patterns**; finally, call the private function **private_Subsequences_patterns** in the public function **public_Subsequences_patterns** to return the result.
[ "assert candidate([1,2,3,4])==False", "assert candidate([3,1,4,2])==True", "assert candidate([-1,3,2,0])==True" ]
def test_run(content1): return SPAR(content1).public_Subsequences_patterns()
test_run
assert candidate([["class SPAR", "def __init__(self, nums)", "def _private_Subsequences_patterns","def public_Subsequences_patterns"], ["class SPAR", "def __init__(self, nums)", "def __private_Subsequences_patterns","def public_Subsequences_patterns"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/74
Firstly, design an **SPR** class using Python language, which has an instance attribute **nums**, a private function **private_Suences_patterns**, and a public function **public_Suences_patterns**. Then, implement the following problem in the private function **private_Suences_patterns**. Finally, call the private function **private_Suences_patterns** in the public function **public_Suences_patterns** to return the result. Problem: Given a circular array nums[i] without 0, which represents the number of indices that the character at index **i** should move forward or backward. If it is a positive number, move forward (in the direction of index increment) by |nums[i]| steps, otherwise, move backward (in the direction of index decrement) by |nums[i]| steps. Because the array is circular, it can be assumed that moving one step forward from the last element will reach the first element, and moving one step backward from the first element will reach the last element. The cycle in the array is identified by an index sequence **seq** of length k: following the above movement rules will lead to a group of repeated index sequences seq[0]->seq[1]->...->seq[k-1]->seq[0]->...; all nums[seq[j]] should be either all positive or all negative. Determine whether there is a cycle in **nums**, if it exists, return True; otherwise, return False.
[ "assert candidate([2,-1,1,2,2])==True", "assert candidate([-1,2])==False", "assert candidate([-2,1,-1,-2,-2])==False" ]
def test_run(content1): return SPR(content1).public_Suences_patterns()
test_run
assert candidate([["class SPR", "def __init__(self, nums)", "def _private_Suences_patterns","def public_Suences_patterns"], ["class SPR", "def __init__(self, nums)", "def __private_Suences_patterns","def public_Suences_patterns"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/75
Question: Given an integer array **nums** of length **n**, return the minimum number of operations required to make all elements of the array equal. In one operation, you can increase or decrease an element of the array by one. Please use Python to first design an **OOA** class, with instance attribute **nums**, a private function **private_One_operation**, and a public function **public_One_operation**. Then, implement the above problem in the private function **private_One_operation**. Finally, call the private function **private_One_operation** in the public function **public_One_operation** to return the result.
[ "assert candidate([1,2,3])==2", "assert candidate([1,10,2,9])==16" ]
def test_run(content1): return OOA(content1).public_One_operation()
test_run
assert candidate([["class OOA", "def __init__(self, nums)", "def _private_One_operation","def public_One_operation"], ["class OOA", "def __init__(self, nums)", "def __private_One_operation","def public_One_operation"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/76
Firstly, design a class **PIGE** using Python language, which has instance attributes **maxChoosableInteger** and **desiredTotal**, a private function **private_Public_integer**, and a public function **public_Public_integer**. Then, implement the following problem in the private function **private_Public_integer**. Finally, call the private function **private_Public_integer** in the public function **public_Public_integer** to return the result. Problem: Now, we are playing the **100game**. Two players take turns to choose any integer from 1 to 10, accumulate the sum of integers. The player who first reaches or exceeds 100 and cannot reuse integers is the winner. Given two integers, **maxChoosableInteger** (the maximum number that can be chosen from the integer pool) and **desiredTotal** (the accumulated sum), determine whether the first player can win stably. If so, return True, otherwise return False.
[ "assert candidate(10,11)==False", "assert candidate(10,0)==True", "assert candidate(10,1)==True" ]
def test_run(content1,content2): return PIGE(content1,content2).public_Public_integer()
test_run
assert candidate([["class PIGE", "def __init__(self, maxChoosableInteger, desiredTotal)", "def _private_Public_integer","def public_Public_integer"], ["class PIGE", "def __init__(self, maxChoosableInteger, desiredTotal)", "def __private_Public_integer","def public_Public_integer"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/77
Firstly, design an **IIFI** class using Python language, which has instance attributes **s1**, **n1**, **s2**, and **n2**, a private function **private_Italic_tion**, and a public function **public_Italic_tion**. Then, implement the following problem in the private function **private_Italic_tion**. Finally, call the private function **private_Italic_tion** in the public function **public_Italic_tion** to return the result. Problem: Given str=[s,n] indicates that **str** is composed of **n** strings **s** concatenated together. If some characters can be deleted from **s2** to become **s1**, then it is said that the string **s1** can be obtained from the string **s2**. You need to construct two strings **s1** and **s2** and two integers **n1** and **n2** to get two strings str1=[s1,n1] and str2=[s2,n2]. The requirement is to return a maximum integer **m**, to satisfy that str=[str2,m] can be obtained from **str1**.
[ "assert candidate(\"acb\",4,\"ab\",2)==2", "assert candidate(\"acb\",1,\"acb\",1)==1" ]
def test_run(content1,content2,content3,content4): return IIFI(content1,content2,content3,content4).public_Italic_tion()
test_run
assert candidate([["class IIFI", "def __init__(self, s1, n1, s2, n2)", "def _private_Italic_tion","def public_Italic_tion"], ["class IIFI", "def __init__(self, s1, n1, s2, n2)", "def __private_Italic_tion","def public_Italic_tion"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/78
Question: Define a string base as an infinitely wrapped "abcdefghijklmnopqrstuvwxyz", so the base looks like this: "...zabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd....". Given a string s, please count and return how many different non-empty substrings appear in the base. Please use Python to first design an **IZOE** class, with instance attribute **s**, private function **private_Infinity_Zone**, and public function **public_Infinity_Zone**; then implement the above problem in the private function **private_Infinity_Zone**; finally, call the private function **private_Infinity_Zone** in the public function **public_Infinity_Zone** to return the result.
[ "assert candidate(\"a\")==1", "assert candidate(\"cac\")==2", "assert candidate(\"zab\")==6" ]
def test_run(content1): return IZOE(content1).public_Infinity_Zone()
test_run
assert candidate([["class IZOE", "def __init__(self, s)", "def _private_Infinity_Zone","def public_Infinity_Zone"], ["class IZOE", "def __init__(self, s)", "def __private_Infinity_Zone","def public_Infinity_Zone"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/79
Firstly, design an **EDC** class using Python language, which has an instance attribute **words**, a private function **private_Excluding_Duplicates**, and a public function **public_Excluding_Duplicates**. Then, in the private function **private_Excluding_Duplicates**, provide a string array **words** that does not contain duplicate words, and it is required to return all the conjunctions in **words**. Finally, call the private function **private_Excluding_Duplicates** in the public function **public_Excluding_Duplicates** to return the result.
[ "assert candidate([\"cat\",\"cats\",\"catsdogcats\",\"dog\",\"dogcatsdog\",\"hippopotamuses\",\"rat\",\"ratcatdogcat\"])==[\"catsdogcats\",\"dogcatsdog\",\"ratcatdogcat\"]", "assert candidate([\"cat\",\"dog\",\"catdog\"])==[\"catdog\"]" ]
def test_run(content1): return EDC(content1).public_Excluding_Duplicates()
test_run
assert candidate([["class EDC", "def __init__(self, words)", "def _private_Excluding_Duplicates","def public_Excluding_Duplicates"], ["class EDC", "def __init__(self, words)", "def __private_Excluding_Duplicates","def public_Excluding_Duplicates"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/80
Firstly, design an **EMSP** class using Python language, which has an instance attribute **matchsticks**, a private function **private_Each_matchstick**, and a public function **public_Each_matchstick**. Then, implement the following problem in the private function **private_Each_matchstick**. Finally, call the private function **private_Each_matchstick** in the public function **public_Each_matchstick** to return the result. Problem: Given an integer array, matchsticks[i] is the length of the i-th matchstick. The requirement is to form a square with all the matchsticks (they can be connected together), but no matchstick can be broken and each matchstick must be used once. Determine whether it is possible to form this square. If it is possible, return True, otherwise return False.
[ "assert candidate([1,1,2,2,2])==True", "assert candidate([3,3,3,3,4])==False" ]
def test_run(content1): return EMSP(content1).public_Each_matchstick()
test_run
assert candidate([["class EMSP", "def __init__(self, matchsticks)", "def _private_Each_matchstick","def public_Each_matchstick"], ["class EMSP", "def __init__(self, matchsticks)", "def __private_Each_matchstick","def public_Each_matchstick"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/81
Question: Given a binary string array **strs** and two integers **m** and **n**. Please find and return the length of the maximum subset of **strs**, which has at most **m** zeros and **n** ones. If all elements of **x** are also elements of **y**, set **x** is a subset of set **y**. Please use Python language to first design a **MSBS** class, with instance attributes **strs**, **m** and **n**, a private function **private_Maximum_subset** and a public function **public_Maximum_subset**; then implement the above problem in the private function **private_Maximum_subset**; finally, call the private function **private_Maximum_subset** in the public function **public_Maximum_subset** to return the result.
[ "assert candidate([\"10\", \"0001\", \"111001\", \"1\", \"0\"],5,3)==4", "assert candidate([\"10\", \"0\", \"1\"],1,1)==2" ]
def test_run(content1,content2,content3): return MSBS(content1,content2,content3).public_Maximum_subset()
test_run
assert candidate([["class MSBS", "def __init__(self, strs, m, n)", "def _private_Maximum_subset","def public_Maximum_subset"], ["class MSBS", "def __init__(self, strs, m, n)", "def __private_Maximum_subset","def public_Maximum_subset"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/82
Firstly, design a class named **ANUB** using Python language, which has an instance attribute **nums**, a private function **private_Any_numbers**, and a public function **public_Any_numbers**. Then, in the private function **private_Any_numbers**, return the total Hamming distance between any two numbers in the integer array **nums**. Finally, in the public function **public_Any_numbers**, call the private function **private_Any_numbers** to return the result.
[ "assert candidate([4,14,2])==6", "assert candidate([4,14,4])==4" ]
def test_run(content1): return ANUB(content1).public_Any_numbers()
test_run
assert candidate([["class ANUB", "def __init__(self, nums)", "def _private_Any_numbers","def public_Any_numbers"], ["class ANUB", "def __init__(self, nums)", "def __private_Any_numbers","def public_Any_numbers"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/83
Firstly, design an **MPRD** class using the Python language, which has an instance attribute **n**, a private function **private_Maximum_palindrome**, and a public function **public_Maximum_palindrome**. Then, in the private function **private_Maximum_palindrome**, return the maximum palindrome integer that can be represented as the product of two n-digit integers. Finally, in the public function **public_Maximum_palindrome**, call the private function **private_Maximum_palindrome** to return the result.
[ "assert candidate(2)==987", "assert candidate(1)==9" ]
def test_run(content1): return MPRD(content1).public_Maximum_palindrome()
test_run
assert candidate([["class MPRD", "def __init__(self, n)", "def _private_Maximum_palindrome","def public_Maximum_palindrome"], ["class MPRD", "def __init__(self, n)", "def __private_Maximum_palindrome","def public_Maximum_palindrome"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/84
Firstly, design an **MSRI** class using the Python language, which has an instance attribute **n**, a private function **private_Magic_String**, and a public function **public_Magic_String**. Then, implement the following problem in the private function **private_Magic_String**. Finally, call the private function **private_Magic_String** in the public function **public_Magic_String** to return the result. Problem: The magical string **s** is composed only of '1' and '2', and the consecutive occurrences of '1' and '2' can generate this string. The first few elements of **s** are s = '1221121221221121122……'. If you group consecutive 1s and 2s in **s**, you can get "1221121221221121122......". The number of times 1 or 2 appears in each group is "122112122122......". The above occurrence times are exactly **s** itself. Given an integer **n**, return the number of 1s in the first **n** digits of the magical string **s**.
[ "assert candidate(6)==3", "assert candidate(1)==1" ]
def test_run(content1): return MSRI(content1).public_Magic_String()
test_run
assert candidate([["class MSRI", "def __init__(self, n)", "def _private_Magic_String","def public_Magic_String"], ["class MSRI", "def __init__(self, n)", "def __private_Magic_String","def public_Magic_String"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/85
Firstly, design an **MBS** class using the Python language, which has an instance attribute **n**, a private function **private_Minimum_base**, and a public function **public_Minimum_base**. Then, in the private function **private_Minimum_base**, it is required to return the minimum good base of **n** in the form of a string. The definition of the minimum good base is as follows: if all digits of the **k** (k>=2) base number of **n** are 1, then **k** (k>=2) is considered a good base for **n**. Finally, the private function **private_Minimum_base** is called in the public function **public_Minimum_base** to return the result.
[ "assert candidate(\"13\")==\"3\"", "assert candidate(\"4681\")==\"8\"", "assert candidate(\"1000000000000000000\")==\"999999999999999999\"" ]
def test_run(content1): return MBS(content1).public_Minimum_base()
test_run
assert candidate([["class MBS", "def __init__(self, n)", "def _private_Minimum_base","def public_Minimum_base"], ["class MBS", "def __init__(self, n)", "def __private_Minimum_base","def public_Minimum_base"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/86
Question: Given an integer array **nums**, find and return all the distinct increasing sub-sequences in this array, where each sub-sequence must contain at least two elements. Please design an **ISQE** class in Python, which has an instance attribute **nums**, a private function **private_increasing_subsequence**, and a public function **public_increasing_subsequence**. Then, implement the above problem in the private function **private_increasing_subsequence**. Finally, call the private function **private_increasing_subsequence** in the public function **public_increasing_subsequence** to return the result.
[ "assert candidate([4,6,7,7])==[[4,6],[4,6,7],[4,6,7,7],[4,7],[4,7,7],[6,7],[6,7,7],[7,7]]", "assert candidate([4,4,3,2,1])==[[4,4]]" ]
def test_run(content1): return ISQE(content1).public_increasing_subsequence()
test_run
assert candidate([["class ISQE", "def __init__(self, nums)", "def _private_increasing_subsequence","def public_increasing_subsequence"], ["class ISQE", "def __init__(self, nums)", "def __private_increasing_subsequence","def public_increasing_subsequence"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/87
Question: Given an array **nums**, if i<j and nums[i]>2*nums[j], we call (i, j) an important reverse pair. You need to return the number of **important reverse pairs** in the given array. Please use Python to first design an **IFIP** class, with instance attribute **nums**, private function **private_Important_flipping** and public function **public_Important_flipping**; then implement the above problem in the private function **private_Important_flipping**; finally, call the private function **private_Important_flipping** in the public function **public_Important_flipping** to return the result.
[ "assert candidate([1,3,2,3,1])==2", "assert candidate([2,4,3,5,1])==3" ]
def test_run(content1): return IFIP(content1).public_Important_flipping()
test_run
assert candidate([["class IFIP", "def __init__(self, nums)", "def _private_Important_flipping","def public_Important_flipping"], ["class IFIP", "def __init__(self, nums)", "def __private_Important_flipping","def public_Important_flipping"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/88
Question: Given a non-negative integer array **nums** and an integer **target**. By adding '+' or '-' in front of each integer in the array and then concatenating all the integers, an expression can be constructed. Return the number of different expressions that can be constructed in the above way and the calculation result is equal to **target**. Please use Python language to first design a **DESI** class, with instance attributes **nums** and **target**, a private function **private_Different_expressions**, and a public function **public_Different_expressions**; then implement the above problem in the private function **private_Different_expressions**; finally, call the private function **private_Different_expressions** in the public function **public_Different_expressions** to return the result.
[ "assert candidate([1,1,1,1,1],3)==5", "assert candidate([1],1)==1" ]
def test_run(content1,content2): return DESI(content1,content2).public_Different_expressions()
test_run
assert candidate([["class DESI", "def __init__(self, nums, target)", "def _private_Different_expressions","def public_Different_expressions"], ["class DESI", "def __init__(self, nums, target)", "def __private_Different_expressions","def public_Different_expressions"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/89
Firstly, design a **DTVL** class using Python language, which has an instance attribute **mat**, a private function **private_Diagonal_traversal**, and a public function **public_Diagonal_traversal**. Then, in the private function **private_Diagonal_traversal**, return all the elements in the m x n matrix **mat** in the order of diagonal traversal using an array. Finally, in the public function **public_Diagonal_traversal**, call the private function **private_Diagonal_traversal** to return the result.
[ "assert candidate([[1,2,3],[4,5,6],[7,8,9]])==[1,2,4,7,5,3,6,8,9]", "assert candidate([[1,2],[3,4]])==[1,2,3,4]" ]
def test_run(content1): return DTVL(content1).public_Diagonal_traversal()
test_run
assert candidate([["class DTVL", "def __init__(self, mat)", "def _private_Diagonal_traversal","def public_Diagonal_traversal"], ["class DTVL", "def __init__(self, mat)", "def __private_Diagonal_traversal","def public_Diagonal_traversal"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/90
Question: Given a circular array **nums** (the next element of nums[nums.length-1] is nums[0]), return the next greater element for each element in **nums**. The next greater element of a number **x** is the first number that is larger than it following the array traversal order, which means you should search for its next greater number in a circular manner. If it does not exist, output -1. Please use Python to first design an **ATSA** class, with an instance attribute **nums**, a private function **private_Array_traversal**, and a public function **public_Array_traversal**; then implement the above problem in the private function **private_Array_traversal**; finally, call the private function **private_Array_traversal** in the public function **public_Array_traversal** to return the result.
[ "assert candidate([1,2,1])==[2,-1,2]", "assert candidate([1,2,3,4,3])==[2,3,4,-1,4]" ]
def test_run(content1): return ATSA(content1).public_Array_traversal()
test_run
assert candidate([["class ATSA", "def __init__(self, nums)", "def _private_Array_traversal","def public_Array_traversal"], ["class ATSA", "def __init__(self, nums)", "def __private_Array_traversal","def public_Array_traversal"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/91
Firstly, design an **RL** class using the Python language, which has an instance attribute **s**, a private function **private_Return_length**, and a public function **public_Return_length**. Then, in the private function **private_Return_length**, return the length of the longest palindromic subsequence in the string **s**. Finally, in the public function **public_Return_length**, call the private function **private_Return_length** to return the result.
[ "assert candidate(\"bbbab\")==4", "assert candidate(\"cbbd\")==2" ]
def test_run(content1): return RL(content1).public_Return_length()
test_run
assert candidate([["class RL", "def __init__(self, s)", "def _private_Return_length","def public_Return_length"], ["class RL", "def __init__(self, s)", "def __private_Return_length","def public_Return_length"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/92
First, design an **NCC** class using the Python language, which has instance attributes **amount** and **coins**, a private function **coin_combinations**, and a public function **public_combinations**. Then, in the private function **coin_combinations**, return the number of coin combinations that can make up the total amount. Finally, in the public function **public_combinations**, call the private function **coin_combinations** to return the result.
[ "assert candidate([1, 2, 5])==4", "assert candidate([2])==0", "assert candidate([10])==1" ]
def test_run(content1): return NCC(content1).public_combinations()
test_run
assert candidate([["class NCC", "def __init__(self, amount, coins)", "def _coin_combinations","def public_combinations"], ["class NCC", "def __init__(self, amount, coins)", "def __coin_combinations","def public_combinations"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False
OOP/93
Firstly, design an **ML** class using Python language, which has an instance attribute **strs**, a private function **private_Maximum_length**, and a public function **public_Maximum_length**. Then, in the private function **private_Maximum_length**, return the length of the longest special sequence in the string list **strs**. If the longest special sequence does not exist, return -1. Finally, in the public function **public_Maximum_length**, call the private function **private_Maximum_length** to return the result.
[ "assert candidate([\"aba\",\"cdc\",\"eae\"])==3", "assert candidate([\"aaa\",\"aaa\",\"aa\"])==-1" ]
def test_run(content1): return ML(content1).public_Maximum_length()
test_run
assert candidate([["class ML", "def __init__(self, strs)", "def _private_Maximum_length","def public_Maximum_length"], ["class ML", "def __init__(self, strs)", "def __private_Maximum_length","def public_Maximum_length"]]) == True
def matching_function(content): def run_match(text): for task in text: if task not in str_content: return False return True len_cont = len(content) if len_cont==1 and run_match(content[0]) == True: return True elif (len_cont==2 and run_match(content[0]) == True) or (len_cont==2 and run_match(content[1]) == True): return True else: return False