task_id stringlengths 5 7 | question stringlengths 192 1.48k | test_list listlengths 2 5 | test_function stringlengths 54 236 | entry_point stringclasses 1
value | test_matching stringlengths 57 291 | test_match_function stringclasses 1
value |
|---|---|---|---|---|---|---|
OOP/201 | Firstly, design an **LPC** class using Python language, which has an instance attribute **pairs**, a private function **private_Longest_pair_chain**, and a public function **public_Longest_pair_chain**. Then, implement the following problem in the private function **private_Longest_pair_chain**. Finally, call the priva... | [
"assert candidate([[1,2], [2,3], [3,4]])==2",
"assert candidate([[1,2],[7,8],[4,5]])==3"
] | def test_run(content1):
return LPC(content1).public_Longest_pair_chain() | test_run | assert candidate([['class LPC', 'def _private_Longest_pair_chain', 'def public_Longest_pair_chain'], ['class LPC', 'def __private_Longest_pair_chain', 'def public_Longest_pair_chain']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/202 | Firstly, design a **PS** class using Python language, which has an instance attribute **s**, a private function **private_Palindrome_substring**, and a public function **public_Palindrome_substring**. Then, return the number of palindrome substrings in the string **s** within the private function **private_Palindrome_s... | [
"assert candidate(\"abc\")==3",
"assert candidate(\"aaa\")==6"
] | def test_run(content1):
return PS(content1).public_Palindrome_substring() | test_run | assert candidate([['class PS', 'def _private_Palindrome_substring', 'def public_Palindrome_substring'], ['class PS', 'def __private_Palindrome_substring', 'def public_Palindrome_substring']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/203 | Firstly, design an **RS** class using the Python language, which has instance attributes **dictionary** and **sentence**, a private function **private_Root_substitution**, and a public function **public_Root_substitution**. Then, implement the following problem in the private function **private_Root_substitution**. Fin... | [
"assert candidate([\"cat\",\"bat\",\"rat\"],\"the cattle was rattled by the battery\")==\"the cat was rat by the bat\"",
"assert candidate([\"a\",\"b\",\"c\"],\"aadsfasf absbs bbab cadsfafs\")==\"a a b c\""
] | def test_run(content1,content2):
return RS(content1,content2).public_Root_substitution() | test_run | assert candidate([['class RS', 'def _private_Root_substitution', 'def public_Root_substitution'], ['class RS', 'def __private_Root_substitution', 'def public_Root_substitution']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/204 | Firstly, design an **MNO** class using Python language, which has an instance attribute **n**, a private function **Minimum_operations**, and a public function **public_Minimum_operations**. Then, implement the following problem in the private function **Minimum_operations**. Finally, call the private function **Minimu... | [
"assert candidate(3)==3",
"assert candidate(1)==0"
] | def test_run(content1):
return MNO(content1).public_Minimum_operations() | test_run | assert candidate([['class MNO', 'def _Minimum_operations', 'def public_Minimum_operations'], ['class MNO', 'def __Minimum_operations', 'def public_Minimum_operations']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/205 | Firstly, design an **FPV** class using Python language, which has instance attributes **arr**, **k**, and **x**, a private function **private_Find_Proximity_Values**, and a public function **public_Find_Proximity_Values**. Then, implement the following problem in the private function **private_Find_Proximity_Values**. ... | [
"assert candidate([1,2,3,4,5],4,3)==[1,2,3,4]",
"assert candidate([1,2,3,4,5],4,-1)==[1,2,3,4]"
] | def test_run(content1,content2,content3):
return FPV(content1,content2,content3).public_Find_Proximity_Values() | test_run | assert candidate([['class FPV', 'def _private_Find_Proximity_Values', 'def public_Find_Proximity_Values'], ['class FPV', 'def __private_Find_Proximity_Values', 'def public_Find_Proximity_Values']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/206 | Firstly, design a **JS** class using the Python language, which has an instance attribute **nums**, a private function **private_Judgment_segmentation**, and a public function **public_Judgment_segmentation**. Then, implement the following problem in the private function **private_Judgment_segmentation**. Finally, call... | [
"assert candidate([1,2,3,3,4,5])==True",
"assert candidate([1,2,3,3,4,4,5,5])==True",
"assert candidate([1,2,3,4,4,5])==False"
] | def test_run(content1):
return JS(content1).public_Judgment_segmentation() | test_run | assert candidate([['class JS', 'def _private_Judgment_segmentation', 'def public_Judgment_segmentation'], ['class JS', 'def _private_Judgment_segmentation', 'def public_Judgment_segmentation']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/207 | Firstly, design an **MPT** class using Python language, which has an instance attribute **s**, a private function **Minimum_Times**, and a public function **public_Minimum_Times**. Then, implement the following problem in the private function **Minimum_Times**. Finally, call the private function **Minimum_Times** in th... | [
"assert candidate(\"aaabbb\")==2",
"assert candidate(\"aba\")==2"
] | def test_run(content1):
return MPT(content1).public_Minimum_Times() | test_run | assert candidate([['class MPT', 'def _Minimum_Times', 'def public_Minimum_Times'], ['class MPT', 'def __Minimum_Times', 'def public_Minimum_Times']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/208 | Firstly, design an **NDC** class using Python language, which has an instance attribute **nums**, a private function **private_Non_decreasing_column**, and a public function **public_Non_decreasing_column**. Then, implement the following problem in the private function **private_Non_decreasing_column**. Finally, call t... | [
"assert candidate([4,2,3])==True",
"assert candidate([4,2,1])==False"
] | def test_run(content1):
return NDC(content1).public_Non_decreasing_column() | test_run | assert candidate([['class NDC', 'def _private_Non_decreasing_column', 'def public_Non_decreasing_column'], ['class NDC', 'def __private_Non_decreasing_column', 'def public_Non_decreasing_column']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/209 | Firstly, design an **AL** class using Python language, which has instance attributes **n** and **k**, a private function **private_Answer_List**, and a public function **public_Answer_List**. Then, return the constructed answer list **answer** in the private function **private_Answer_List**. Finally, call the private f... | [
"assert candidate(3,1)==[1, 2, 3]",
"assert candidate(3,2)==[1, 3, 2]"
] | def test_run(content1,content2):
return AL(content1,content2).public_Answer_List() | test_run | assert candidate([['class AL', 'def _private_Answer_List', 'def public_Answer_List'], ['class AL', 'def _private_Answer_List', 'def public_Answer_List']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/210 | Firstly, design a class named **LIS** using Python language, which has instance attribute **nums**, a private function **lo_in_sub**, and a public function **public_lo_in_sub**. Then, in the private function **lo_in_sub**, return the count of the longest increasing subsequence from the unsorted integer array **nums**. ... | [
"assert candidate([1,3,5,4,7])==2",
"assert candidate([2,2,2,2,2])==5"
] | def test_run(content1):
return LIS(content1).public_lo_in_sub() | test_run | assert candidate([['class LIS', 'def _lo_in_sub', 'def public_lo_in_sub'], ['class LIS', 'def __lo_in_sub', 'def public_lo_in_sub']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/211 | Firstly, design a **CDT** class using Python language, which has an instance attribute **forest**, a private function **private_Chop_down_trees**, and a public function **public_Chop_down_trees**. Then, implement the following problem in the private function **private_Chop_down_trees**. Finally, call the private functi... | [
"assert candidate([[1,2,3],[0,0,4],[7,6,5]])==6",
"assert candidate([[1,2,3],[0,0,0],[7,6,5]])==-1",
"assert candidate([[2,3,4],[0,0,5],[8,7,6]])==6"
] | def test_run(content1):
return CDT(content1).public_Chop_down_trees() | test_run | assert candidate([['class CDT', 'def _private_Chop_down_trees', 'def public_Chop_down_trees'], ['class CDT', 'def __private_Chop_down_trees', 'def public_Chop_down_trees']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/212 | Firstly, design a **VS** class using Python language, which has an instance attribute **s**, a private function **private_Valid_String**, and a public function **public_Valid_String**. Then, implement the following problem in the private function **private_Valid_String**. Finally, call the private function **private_Va... | [
"assert candidate(\"()\")==True",
"assert candidate(\"(*)\")==True",
"assert candidate(\"(*))\")==True"
] | def test_run(content1):
return VS(content1).public_Valid_String() | test_run | assert candidate([['class VS', 'def _private_Valid_String', 'def public_Valid_String'], ['class VS', 'def __private_Valid_String', 'def public_Valid_String']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/213 | Firstly, design a class **ME** using the Python language, which has an instance attribute **cards**, a private function **private_mathematical_expression**, and a public function **public_mathematical_expression**. Then, implement the following problem in the private function **private_mathematical_expression**. Finall... | [
"assert candidate([4, 1, 8, 7])==True",
"assert candidate([1, 2, 1, 2])==False"
] | def test_run(content1):
return ME(content1).public_mathematical_expression() | test_run | assert candidate([['class ME', 'def _private_mathematical_expression', 'def public_mathematical_expression'], ['class ME', 'def __private_mathematical_expression', 'def public_mathematical_expression']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/214 | Firstly, design an **OS** class using Python language, which has instance attributes **a** and **b**, a private function **private_Overlay_substring**, and a public function **public_Overlay_substring**. Then, implement the following problem in the private function **private_Overlay_substring**. Finally, call the priva... | [
"assert candidate(\"abcd\",\"cdabcdab\")==3",
"assert candidate(\"a\",\"aa\")==2",
"assert candidate(\"a\",\"a\")==1",
"assert candidate(\"abc\",\"wxyz\")==-1"
] | def test_run(content1,content2):
return OS(content1,content2).public_Overlay_substring() | test_run | assert candidate([['class OS', 'def _private_Overlay_substring', 'def public_Overlay_substring'], ['class OS', 'def __private_Overlay_substring', 'def public_Overlay_substring']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/215 | Firstly, design a **KC** class using Python language, which has instance attributes **n**, **k**, **row**, and **column**, a private function **private_Knight_Chessboard**, and a public function **public_Knight_Chessboard**. Then, implement the following problem in the private function **private_Knight_Chessboard**. Fi... | [
"assert candidate(3,2,0,0)==0.0625",
"assert candidate(1,0,0,0)==1.00000"
] | def test_run(content1,content2,content3,content4):
return KC(content1,content2,content3,content4).public_Knight_Chessboard() | test_run | assert candidate([['class KC', 'def _private_Knight_Chessboard', 'def public_Knight_Chessboard'], ['class KC', 'def __private_Knight_Chessboard', 'def public_Knight_Chessboard']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/216 | Firstly, design an **MS** class using Python language, which has instance attributes **nums** and **k**, a private function **private_Maximum_subarray**, and a public function **public_Maximum_subarray**. Then, implement the following problem in the private function **private_Maximum_subarray**. Finally, call the priva... | [
"assert candidate([1,2,1,2,6,7,5,1],2)==[0,3,5]",
"assert candidate([1,2,1,2,1,2,1,2,1],2)==[0,2,4]"
] | def test_run(content1,content2):
return MS(content1,content2).public_Maximum_subarray() | test_run | assert candidate([['class MS', 'def _private_Maximum_subarray', 'def public_Maximum_subarray'], ['class MS', 'def __private_Maximum_subarray', 'def public_Maximum_subarray']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/217 | Firstly, design a class named **SW** using Python language, which has instance attributes **stickers** and **target**, a private function **private_Sticker_Words**, and a public function **public_Sticker_Words**. Then, implement the following problem in the private function **private_Sticker_Words**. Finally, call the ... | [
"assert candidate([\"with\",\"example\",\"science\"],\"thehat\")==3",
"assert candidate([\"notice\",\"possible\"],\"basicbasic\")==-1"
] | def test_run(content1,content2):
return SW(content1,content2).public_Sticker_Words() | test_run | assert candidate([['class SW', 'def _private_Sticker_Words', 'def public_Sticker_Words'], ['class SW', 'def __private_Sticker_Words', 'def public_Sticker_Words']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/218 | Firstly, design an **MT** class using the Python language, which has instance attributes **words** and **k**, a private function **private_Most_times**, and a public function **public_Most_times**. Then, in the private function **private_Most_times**, return the top **k** most frequently occurring words from a given wo... | [
"assert candidate([\"i\", \"love\", \"leetcode\", \"i\", \"love\", \"coding\"],2)==[\"i\", \"love\"]",
"assert candidate([\"the\", \"day\", \"is\", \"sunny\", \"the\", \"the\", \"the\", \"sunny\", \"is\", \"is\"],4)==[\"the\", \"is\", \"sunny\", \"day\"]"
] | def test_run(content1,content2):
return MT(content1,content2).public_Most_times() | test_run | assert candidate([['class MT', 'def _private_Most_times', 'def public_Most_times'], ['class MT', 'def __private_Most_times', 'def public_Most_times']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/219 | Firstly, design an **AA** class using the Python language, which has an instance attribute **n**, a private function **private_Alternating_appearance**, and a public function **public_Alternating_appearance**. Then, implement the following problem in the private function **private_Alternating_appearance**. Finally, cal... | [
"assert candidate(5)==True",
"assert candidate(7)==False",
"assert candidate(11)==False"
] | def test_run(content1):
return AA(content1).public_Alternating_appearance() | test_run | assert candidate([['class AA', 'def _private_Alternating_appearance', 'def public_Alternating_appearance'], ['class AA', 'def __private_Alternating_appearance', 'def public_Alternating_appearance']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/220 | Firstly, design an **IA** class using Python language, which has an instance attribute **grid**, a private function **private_Island_area**, and a public function **public_Island_area**. Then, implement the following problem in the private function **private_Island_area**. Finally, call the private function **private_I... | [
"assert candidate([[0,0,1,0,0,0,0,1,0,0,0,0,0],[0,0,0,0,0,0,0,1,1,1,0,0,0],[0,1,1,0,1,0,0,0,0,0,0,0,0],[0,1,0,0,1,1,0,0,1,0,1,0,0],[0,1,0,0,1,1,0,0,1,1,1,0,0],[0,0,0,0,0,0,0,0,0,0,1,0,0],[0,0,0,0,0,0,0,1,1,1,0,0,0],[0,0,0,0,0,0,0,1,1,0,0,0,0]])==6",
"assert candidate([[0,0,0,0,0,0,0,0]])==0"
] | def test_run(content1):
return IA(content1).public_Island_area() | test_run | assert candidate([['class IA', 'def _private_Island_area', 'def public_Island_area'], ['class IA', 'def __private_Island_area', 'def public_Island_area']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/221 | Firstly, design an **ES** class using Python language, which has instance attributes **nums** and **k**, a private function **private_Equal_sum**, and a public function **public_Equal_sum**. Then, in the private function **private_Equal_sum**, determine whether it is possible to divide this array into **k** non-empty s... | [
"assert candidate([4, 3, 2, 3, 5, 2, 1],4)==True",
"assert candidate([1,2,3,4],3)==False"
] | def test_run(content1,content2):
return ES(content1,content2).public_Equal_sum() | test_run | assert candidate([['class ES', 'def _private_Equal_sum', 'def public_Equal_sum'], ['class ES', 'def __private_Equal_sum', 'def public_Equal_sum']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/222 | Firstly, design a **BS** class using Python language, which has an instance attribute **positions**, a private function **private_Block_stacking**, and a public function **public_Block_stacking**. Then, implement the following problem in the private function **private_Block_stacking**. Finally, call the private functio... | [
"assert candidate([[1,2],[2,3],[6,1]])==[2,5,5]",
"assert candidate([[100,100],[200,100]])==[100,100]"
] | def test_run(content1):
return BS(content1).public_Block_stacking() | test_run | assert candidate([['class BS', 'def _private_Block_stacking', 'def public_Block_stacking'], ['class BS', 'def __private_Block_stacking', 'def public_Block_stacking']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/223 | Firstly, design a **DC** class using the Python language, which has instance attributes **s1** and **s2**, a private function **private_Delete_Characters**, and a public function **public_Delete_Characters**. Then, in the private function **private_Delete_Characters**, return the minimum sum of the ASCII values of the ... | [
"assert candidate(\"sea\",\"eat\")==231",
"assert candidate(\"delete\",\"leet\")==403"
] | def test_run(content1,content2):
return DC(content1,content2).public_Delete_Characters() | test_run | assert candidate([['class DC', 'def _private_Delete_Characters', 'def public_Delete_Characters'], ['class DC', 'def __private_Delete_Characters', 'def public_Delete_Characters']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/224 | Firstly, design a **POE** class using Python language, which has instance attributes **nums** and **k**, a private function **private_Product_of_elements**, and a public function **public_Product_of_elements**. Then, in the private function **private_Product_of_elements**, return the number of continuous subarrays wher... | [
"assert candidate([10,5,2,6],100)==8",
"assert candidate([1,2,3],0)==0"
] | def test_run(content1,content2):
return POE(content1,content2).public_Product_of_elements() | test_run | assert candidate([['class POE', 'def _private_Product_of_elements', 'def public_Product_of_elements'], ['class POE', 'def __private_Product_of_elements', 'def public_Product_of_elements']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/225 | Firstly, design a **BS** class using Python language, which has instance attributes **prices** and **fee**, a private function **private_buy_share**, and a public function **public_buy_share**. Then, implement the following problem in the private function **private_buy_share**. Finally, call the private function **priv... | [
"assert candidate([1, 3, 2, 8, 4, 9],2)==8",
"assert candidate([1,3,7,5,10,3],3)==6"
] | def test_run(content1,content2):
return BS(content1,content2).public_buy_share() | test_run | assert candidate([['class BS', 'def _private_buy_share', 'def public_buy_share'], ['class BS', 'def __private_buy_share', 'def public_buy_share']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/226 | Firstly, design a **BC** class using the Python language, which has an instance attribute **bits**, a private function **private_Bit_character**, and a public function **public_Bit_character**. Then, implement the following problem in the private function **private_Bit_character**. Finally, call the private function **... | [
"assert candidate([1, 0, 0])==True",
"assert candidate([1,1,1,0])==False"
] | def test_run(content1):
return BC(content1).public_Bit_character() | test_run | assert candidate([['class BC', 'def _private_Bit_character', 'def public_Bit_character'], ['class BC', 'def __private_Bit_character', 'def public_Bit_character']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/227 | Firstly, design a **BL** class using Python language, which has instance attributes **nums1** and **nums2**, a private function **private_BLongest_length**, and a public function **public_BLongest_length**. Then, in the private function **private_BLongest_length**, return the length of the longest common subarray from ... | [
"assert candidate([1,2,3,2,1],[3,2,1,4,7])==3",
"assert candidate([0,0,0,0,0],[0,0,0,0,0])==5"
] | def test_run(content1,content2):
return BL(content1,content2).public_BLongest_length() | test_run | assert candidate([['class BL', 'def _private_BLongest_length', 'def public_BLongest_length'], ['class BL', 'def __private_BLongest_length', 'def public_BLongest_length']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/228 | Firstly, design an **AD** class using Python language, which has instance attributes **nums** and **k**, a private function **private_absolute_difference**, and a public function **public_absolute_difference**. Then, implement the following problem in the private function **private_absolute_difference**. Finally, call ... | [
"assert candidate([1,3,1],1)==0",
"assert candidate([1,1,1],2)==0",
"assert candidate([1,6,1],3)==5"
] | def test_run(content1,content2):
return AD(content1,content2).public_absolute_difference() | test_run | assert candidate([['class AD', 'def _private_absolute_difference', 'def public_absolute_difference'], ['class AD', 'def __private_absolute_difference', 'def public_absolute_difference']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/229 | Firstly, design an **ED** class using the Python language, which has an instance attribute **words**, a private function **private_English_Dictionary**, and a public function **public_English_Dictionary**. Then, implement the following problem in the private function **private_English_Dictionary**. Finally, call the pr... | [
"assert candidate([\"w\",\"wo\",\"wor\",\"worl\", \"world\"])==\"world\"",
"assert candidate([\"a\", \"banana\", \"app\", \"appl\", \"ap\", \"apply\", \"apple\"])==\"apple\""
] | def test_run(content1):
return ED(content1).public_English_Dictionary() | test_run | assert candidate([['class ED', 'def _private_English_Dictionary', 'def public_English_Dictionary'], ['class ED', 'def __private_English_Dictionary', 'def public_English_Dictionary']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/230 | Firstly, design an **LS** class using Python language, which has instance attributes **head** and **k**, a private function **private_List_separation**, and a public function **public_List_separation**. Then, implement the following problem in the private function **private_List_separation**. Finally, call the private ... | [
"assert candidate([1,2,3],5)==[[1],[2],[3],[],[]]",
"assert candidate([1,2,3,4,5,6,7,8,9,10],3)==[[1,2,3,4],[5,6,7],[8,9,10]]"
] | def test_run(content1,content2):
return LS(content1,content2).public_public_List_separation() | test_run | assert candidate([['class LS', 'def _private_List_separation', 'def public_List_separation'], ['class LS', 'def __private_List_separation', 'def public_List_separation']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/231 | Firstly, design a **NOS** class using the Python language, which has an instance attribute **s**, a private function **private_Number_of_sequences**, and a public function **public_Number_of_sequences**. Then, in the private function **private_Number_of_sequences**, return the number of different non-empty palindrome s... | [
"assert candidate('bccb')==6",
"assert candidate('abcdabcdabcdabcdabcdabcdabcdabcddcbadcbadcbadcbadcbadcbadcbadcba')==104860361"
] | def test_run(content1):
return NOS(content1).public_Number_of_sequences() | test_run | assert candidate([['class NOS', 'def _private_Number_of_sequences', 'def public_Number_of_sequences'], ['class NOS', 'def __private_Number_of_sequences', 'def public_Number_of_sequences']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/232 | Firstly, design an **MI** class using Python language, which has an instance attribute **n**, a private function **private_monotonic_increase**, and a public function **public_monotonic_increase**. Then, implement the following problem in the private function **private_monotonic_increase**. Finally, call the private fu... | [
"assert candidate(10)==9",
"assert candidate(1234)==1234",
"assert candidate(332)==299"
] | def test_run(content1):
return MI(content1).public_monotonic_increase() | test_run | assert candidate([['class MI', 'def _private_monotonic_increase', 'def public_monotonic_increase'], ['class MI', 'def __private_monotonic_increase', 'def public_monotonic_increase']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/233 | Firstly, design a class **TR** using the Python language, which has an instance attribute **temperatures**, a private function **private_Temperature_rise**, and a public function **public_Temperature_rise**. Then, implement the following problem in the private function **private_Temperature_rise**. Finally, call the pr... | [
"assert candidate([73,74,75,71,69,72,76,73])==[1,1,4,2,1,1,0,0]",
"assert candidate([30,40,50,60])==[1,1,1,0]",
"assert candidate([30,60,90])==[1,1,0]"
] | def test_run(content1):
return TR(content1).public_Temperature_rise() | test_run | assert candidate([['class TR', 'def _private_Temperature_rise', 'def public_Temperature_rise'], ['class TR', 'def __private_Temperature_rise', 'def public_Temperature_rise']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/234 | Firstly, design a class **MN** using the Python language, which has an instance attribute **nums**, a private function **private_Maximum_number**, and a public function **public_Maximum_number**. Then, implement the following problem in the private function **private_Maximum_number**. Finally, call the private function... | [
"assert candidate([3,4,2])==6",
"assert candidate([2,2,3,3,3,4])==9"
] | def test_run(content1):
return MN(content1).public_Maximum_number() | test_run | assert candidate([['class MN', 'def _private_Maximum_number', 'def public_Maximum_number'], ['class MN', 'def __private_Maximum_number', 'def public_Maximum_number']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/235 | Firstly, design a class **NN** using the Python language, which has instance attributes **times**, **n** and **k**, a private function **private_network_node**, and a public function **public_network_node**. Then, implement the following problem in the private function **private_network_node**. Finally, call the privat... | [
"assert candidate([[2,1,1],[2,3,1],[3,4,1]],4,2)==2",
"assert candidate([[1,2,1]],2,1)==1",
"assert candidate([[1,2,1]],2,2)==-1"
] | def test_run(content1,content2,content3):
return NN(content1,content2,content3).public_network_node() | test_run | assert candidate([['class NN', 'def _private_network_node', 'def public_network_node'], ['class NN', 'def __private_network_node', 'def public_network_node']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/236 | Firstly, design an **INA** class using Python language, which has an instance attribute **target**, a private function **private_Infinite_number_axis**, and a public function **public_Infinite_number_axis**. Then, implement the following problem in the private function **private_Infinite_number_axis**. Finally, call th... | [
"assert candidate(2)==3",
"assert candidate(3)==2"
] | def test_run(content1):
return INA(content1).public_Infinite_number_axis() | test_run | assert candidate([['class INA', 'def _private_Infinite_number_axis', 'def public_Infinite_number_axis'], ['class INA', 'def __private_Infinite_number_axis', 'def public_Infinite_number_axis']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/237 | Firstly, design an **IC** class using Python language, which has an instance attribute **intervals**, a private function **private_Include_Collection**, and a public function **public_Include_Collection**. Then, implement the following problem in the private function **private_Include_Collection**. Finally, call the pr... | [
"assert candidate([[1,3],[3,7],[8,9]])==5",
"assert candidate([[1,3],[1,4],[2,5],[3,5]])==3",
"assert candidate([[1,2],[2,3],[2,4],[4,5]])==5"
] | def test_run(content1):
return IC(content1).public_Include_Collection() | test_run | assert candidate([['class IC', 'def _private_Include_Collection', 'def public_Include_Collection'], ['class IC', 'def __private_Include_Collection', 'def public_Include_Collection']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/238 | Firstly, design a class **SP** using Python language, which has an instance attribute **s**, a private function **private_String_partitioning**, and a public function **public_String_partitioning**. Then, implement the following problem in the private function **private_String_partitioning**. Finally, call the private ... | [
"assert candidate(\"ababcbacadefegdehijhklij\")==[9,7,8]",
"assert candidate(\"eccbbbbdec\")==[10]"
] | def test_run(content1):
return SP(content1).public_String_partitioning() | test_run | assert candidate([['class SP', 'def _private_String_partitioning', 'def public_String_partitioning'], ['class SP', 'def __private_String_partitioning', 'def public_String_partitioning']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/239 | Firstly, design a **PS** class using Python language, which has instance attributes **n** and **mines**, a private function **private_Plus_sign**, and a public function **public_Plus_sign**. Then, implement the following problem in the private function **private_Plus_sign**. Finally, call the private function **private... | [
"assert candidate(5,[[4, 2]])==2",
"assert candidate(1,[[0, 0]])==0"
] | def test_run(content1,content2):
return PS(content1,content2).public_Plus_sign() | test_run | assert candidate([['class PS', 'def _private_Plus_sign', 'def public_Plus_sign'], ['class PS', 'def __private_Plus_sign', 'def public_Plus_sign']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/240 | Firstly, design an **ES** class using Python language, which has an instance attribute **row**, a private function **private_Exchange_seats**, and a public function **public_Exchange_seats**. Then, implement the following problem in the private function **private_Exchange_seats**. Finally, call the private function **p... | [
"assert candidate([0,2,1,3])==1",
"assert candidate([3,2,0,1])==0"
] | def test_run(content1):
return ES(content1).public_Exchange_seats() | test_run | assert candidate([['class ES', 'def _private_Exchange_seats', 'def public_Exchange_seats'], ['class ES', 'def __private_Exchange_seats', 'def public_Exchange_seats']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/241 | Firstly, design a **JM** class using Python language, which has an instance attribute **matrix**, a private function **private_judgment_matrix**, and a public function **public_judgment_matrix**. Then, in the private function **private_judgment_matrix**, determine whether a given m x n **matrix** is a Toeplitz matrix. ... | [
"assert candidate([[1,2,3,4],[5,1,2,3],[9,5,1,2]])==True",
"assert candidate([[1,2],[2,2]])==False"
] | def test_run(content1):
return JM(content1).public_judgment_matrix() | test_run | assert candidate([['class JM', 'def _private_judgment_matrix', 'def public_judgment_matrix'], ['class JM', 'def _private_judgment_matrix', 'def public_judgment_matrix']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/242 | First, design an **RL** class using the Python language, which has an instance attribute **s**, a private function **private_Rearrange_letters**, and a public function **public_Rearrange_letters**. Then, implement the following problem in the private function **private_Rearrange_letters**. Finally, call the private fun... | [
"assert candidate(\"aab\")==\"aba\"",
"assert candidate(\"aaab\")==\"\""
] | def test_run(content1):
return RL(content1).public_Rearrange_letters() | test_run | assert candidate([['class RL', 'def _private_Rearrange_letters', 'def public_Rearrange_letters'], ['class RL', 'def _private_Rearrange_letters', 'def public_Rearrange_letters']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/243 | Firstly, design an **MNB** class using the Python language, which has an instance attribute **arr**, a private function **private_Maximum_number_blocks**, and a public function **public_Maximum_number_blocks**. Then, implement the following problem in the private function **private_Maximum_number_blocks**. Finally, cal... | [
"assert candidate([5,4,3,2,1])==1",
"assert candidate([2,1,3,4,4])==4"
] | def test_run(content1):
return MNB(content1).public_Maximum_number_blocks() | test_run | assert candidate([['class MNB', 'def _private_Maximum_number_blocks', 'def public_Maximum_number_blocks'], ['class MNB', 'def __private_Maximum_number_blocks', 'def public_Maximum_number_blocks']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/244 | Firstly, design a class named **SS** using Python language, which includes an instance attribute **arr**, a private function **private_Sort_separately**, and a public function **public_Sort_separately**. Then, implement the following problem in the private function **private_Sort_separately**. Finally, call the private... | [
"assert candidate([4,3,2,1,0])==1",
"assert candidate([1,0,2,3,4])==4"
] | def test_run(content1):
return SS(content1).public_Sort_separately() | test_run | assert candidate([['class SS', 'def _private_Sort_separately', 'def public_Sort_separately'], ['class SS', 'def __private_Sort_separately', 'def public_Sort_separately']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/245 | Firstly, design a class **SPB** using Python language, which has an instance attribute **board**, a private function **private_Solving_puzzle_board**, and a public function **public_Solving_puzzle_board**. Then, implement the following problem in the private function **private_Solving_puzzle_board**. Finally, call the ... | [
"assert candidate([[1,2,3],[4,0,5]])==1",
"assert candidate([[1,2,3],[5,4,0]])==-1",
"assert candidate([[4,1,2],[5,0,3]])==5"
] | def test_run(content1):
return SPB(content1).public_Solving_puzzle_board() | test_run | assert candidate([['class SPB', 'def _private_Solving_puzzle_board', 'def public_Solving_puzzle_board'], ['class SPB', 'def __private_Solving_puzzle_board', 'def public_Solving_puzzle_board']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/246 | Firstly, design a class **LI** using Python language, which has an instance attribute **nums**, a private function **private_Local_inversion**, and a public function **public_Local_inversion**. Then, implement the following problem in the private function **private_Local_inversion**. Finally, call the private function ... | [
"assert candidate([1,0,2])==True",
"assert candidate([1,2,0])==False"
] | def test_run(content1):
return LI(content1).public_Local_inversion() | test_run | assert candidate([['class LI', 'def _private_Local_inversion', 'def public_Local_inversion'], ['class LI', 'def __private_Local_inversion', 'def public_Local_inversion']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/247 | Firstly, design a class **GS** using the Python language, which has an instance attribute **grid**, a private function **private_Grid_swimming**, and a public function **public_Grid_swimming**. Then, implement the following problem in the private function **private_Grid_swimming**. Finally, call the private function **... | [
"assert candidate([[0,2],[1,3]])==3",
"assert candidate([[0,1,2,3,4],[24,23,22,21,5],[12,13,14,15,16],[11,17,18,19,20],[10,9,8,7,6]])==16"
] | def test_run(content1):
return GS(content1).public_Grid_swimming() | test_run | assert candidate([['class GS', 'def _private_Grid_swimming', 'def public_Grid_swimming'], ['class GS', 'def __private_Grid_swimming', 'def public_Grid_swimming']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/248 | Firstly, design a **GNR** class using Python language, which has instance attributes **n** and **k**, a private function **private_Given_number_rows**, and a public function **public_Given_number_rows**. Then, implement the following problem in the private function **private_Given_number_rows**. Finally, call the priva... | [
"assert candidate(1,1)==0",
"assert candidate(2,1)==0",
"assert candidate(2,2)==1"
] | def test_run(content1,content2):
return GNR(content1,content2).public_Given_number_rows() | test_run | assert candidate([['class GNR', 'def _private_Given_number_rows', 'def public_Given_number_rows'], ['class GNR', 'def __private_Given_number_rows', 'def public_Given_number_rows']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/249 | Firstly, design a **CN** class using Python language, which has instance attributes **sx**, **sy**, **tx**, and **ty**, a private function **private_Convert_numbers**, and a public function **public_Convert_numbers**. Then, implement the following problem in the private function **private_Convert_numbers**. Finally, ca... | [
"assert candidate(1,1,3,5)==True",
"assert candidate(1,1,2,2)==False",
"assert candidate(1,1,1,1)==True"
] | def test_run(content1,content2,content3,content4):
return CN(content1,content2,content3,content4).public_Convert_numbers() | test_run | assert candidate([['class CN', 'def _private_Convert_numbers', 'def public_Convert_numbers'], ['class CN', 'def __private_Convert_numbers', 'def public_Convert_numbers']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/250 | First, design a class **FR** using the Python language, which has an instance attribute **answers**, a private function **private_Forest_Rabbit**, and a public function **public_Forest_Rabbit**. Then, implement the following problem in the private function **private_Forest_Rabbit**. Finally, call the private function *... | [
"assert candidate([1,1,2])==5",
"assert candidate([10,10,10])==11"
] | def test_run(content1):
return FR(content1).public_Forest_Rabbit() | test_run | assert candidate([['class FR', 'def _private_Forest_Rabbit', 'def public_Forest_Rabbit'], ['class FR', 'def __private_Forest_Rabbit', 'def public_Forest_Rabbit']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/251 | Firstly, design a class **NM** using the Python language, which has an instance attribute **board**, a private function **private_Network_Matrix**, and a public function **public_Network_Matrix**. Then, implement the following problem in the private function **private_Network_Matrix**. Finally, call the private functio... | [
"assert candidate([[0,1,1,0],[0,1,1,0],[1,0,0,1],[1,0,0,1]])==2",
"assert candidate([[0,1],[1,0]])==0",
"assert candidate([[1,0],[1,0]])==-1"
] | def test_run(content1):
return NM(content1).public_Network_Matrix() | test_run | assert candidate([['class NM', 'def _private_Network_Matrix', 'def public_Network_Matrix'], ['class NM', 'def __private_Network_Matrix', 'def public_Network_Matrix']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/252 | Firstly, design a class **CC** using Python language, which has an instance attribute **s**, a private function **private_Change_Case**, and a public function **public_Change_Case**. Then, implement the following problem in the private function **private_Change_Case**. Finally, call the private function **private_Chang... | [
"assert candidate(\"a1b2\")==[\"a1b2\", \"a1B2\", \"A1b2\", \"A1B2\"]",
"assert candidate(\"3z4\")==[\"3z4\",\"3Z4\"]"
] | def test_run(content1):
return CC(content1).public_Change_Case() | test_run | assert candidate([['class CC', 'def _private_Change_Case', 'def public_Change_Case'], ['class CC', 'def __private_Change_Case', 'def public_Change_Case']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/253 | Firstly, design a class **MS** using the Python language, which has instance attributes **arr** and **k**, a private function **private_Minimum_score**, and a public function **public_Minimum_score**. Then, implement the following problem in the private function **private_Minimum_score**. Finally, call the private func... | [
"assert candidate([1,2,3,5],3)==[2,5]",
"assert candidate([1,7],1)==[1,7]"
] | def test_run(content1,content2):
return MS(content1,content2).public_Minimum_score() | test_run | assert candidate([['class MS', 'def _private_Minimum_score', 'def public_Minimum_score'], ['class MS', 'def __private_Minimum_score', 'def public_Minimum_score']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/254 | Firstly, design a **PM** class using Python language, which has instance attributes **order** and **s**, a private function **private_Permutation_matching**, and a public function **public_Permutation_matching**. Then, implement the following problem in the private function **private_Permutation_matching**. Finally, ca... | [
"assert candidate(\"cba\",\"abcd\")==\"cbad\"",
"assert candidate(\"cbafg\",\"abcd\")==\"cbad\""
] | def test_run(content1,content2):
return PM(content1,content2).public_Permutation_matching() | test_run | assert candidate([['class PM', 'def _private_Permutation_matching', 'def public_Permutation_matching'], ['class PM', 'def _private_Permutation_matching', 'def public_Permutation_matching']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/255 | Firstly, design a class **NW** using the Python language, which has instance attributes **s** and **words**, a private function **private_Number_words**, and a public function **public_Number_words**. Then, in the private function **private_Number_words**, return the number of words in words[i] that are subsequences of... | [
"assert candidate(\"abcde\",[\"a\",\"bb\",\"acd\",\"ace\"])==3",
"assert candidate(\"dsahjpjauf\",[\"ahjpjau\",\"ja\",\"ahbwzgqnuk\",\"tnmlanowax\"])==2"
] | def test_run(content1,content2):
return NW(content1,content2).public_Number_words() | test_run | assert candidate([['class NW', 'def _private_Number_words', 'def public_Number_words'], ['class NW', 'def __private_Number_words', 'def public_Number_words']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/256 | Firstly, design a class **NI** using Python language, which has an instance attribute **k**, a private function **private_nonnegative_integer**, and a public function **public_nonnegative_integer**. Then, implement the following problem in the private function **private_nonnegative_integer**. Finally, call the private ... | [
"assert candidate(0)==5",
"assert candidate(5)==0",
"assert candidate(3)==5"
] | def test_run(content1):
return NI(content1).public_nonnegative_integer() | test_run | assert candidate([['class NI', 'def _private_nonnegative_integer', 'def public_nonnegative_integer'], ['class NI', 'def __private_nonnegative_integer', 'def public_nonnegative_integer']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/2 | Question: Given an integer array **nums** and two integers **left** and **right**. Find the number of subarrays in **nums** that are continuous, non-empty, and have the maximum element within the range [left, right].
Please create a class called FDSB in Python based on the above problem, with the **nums** attribute. T... | [
"assert candidate([2,1,4,3],2,3)==3",
"assert candidate([2,9,2,5,6],2,8)==7"
] | def test_run(content1,content2,content3):
return SN_FDSB(content1,content2,content3).find_subarray() | test_run | assert candidate([['class FDSB', 'def find_subarray', 'super().__init__(nums)', '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]... |
OOP/257 | Question: Given an integer array **nums** and two integers: **left** and **right**. Find the continuous, non-empty subarrays in **nums** where the maximum element is within the range [left, right] and return the number of such subarrays that meet the conditions.
Based on the above question, create a class **FDSB** in P... | [
"assert candidate([2,1,4,3],2,3)==3",
"assert candidate([2,9,2,5,6],2,8)==7"
] | def test_run(content1,content2,content3):
return SN_FDSB(content1,content2,content3).find_subarray() | test_run | assert candidate([['class FDSB', 'class SN_FDSB(FDSB)', 'super().__init__(nums)', '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]... |
OOP/258 | Question: Given a directed acyclic graph (DAG) with **n** nodes, find and output all paths from node 0 to node n-1;
Based on the above question, create a class **PO** in Python with the attribute **graph**; then create another class **SN_PO**, inheriting from the **PO** class, and add a public function **Path_output** ... | [
"assert candidate([[1,2],[3],[3],[]])==[[0,1,3],[0,2,3]]",
"assert candidate([[4,3,1],[3,2,4],[3],[4],[]])==[[0,4],[0,3,4],[0,1,3,4],[0,1,2,3,4],[0,1,4]]"
] | def test_run(content1):
return SN_PO(content1).Path_output() | test_run | assert candidate([['class PO', 'class SN_PO(PO)', 'super().__init__(graph)', 'def Path_output']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/259 | Question: Given two integer arrays **nums1** and **nums2** of equal length and not empty. In one operation, you can swap the elements of nums1[i] and nums2[i]. For example, if nums1=[1,2,3,8], nums2=[5,6,7,4], you can swap the element at i=3 to get nums1=[1,2,3,4] and nums2=[5,6,7,8]. Return the minimum number of opera... | [
"assert candidate([1,3,5,4],[1,2,3,7])==1",
"assert candidate([0,3,5,8,9],[2,1,4,6,9])==1"
] | def test_run(content1,content2):
return SN_EE(content1,content2).Exchange_Elements() | test_run | assert candidate([['class EE', 'class SN_EE(EE)', 'super().__init__(nums1)', 'def Exchange_Elements']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/260 | Question: Given a directed graph with **n** nodes numbered from 0 to n-1, the graph is represented by a 2D integer array **graph** indexed from 0, where graph[i] is an integer array of nodes adjacent to node **i**, meaning there is an edge from node **i** to each node in **graph[i]**. If a node has no outgoing directed... | [
"assert candidate([[1,2],[2,3],[5],[0],[5],[],[]])==[2,4,5,6]",
"assert candidate([[1,2,3,4],[1,2],[3,4],[0,4],[]])==[4]"
] | def test_run(content1):
return SN_SND(content1).secure_node() | test_run | assert candidate([['class SND', 'class SN_SND(SND)', 'super().__init__(graph)', 'def secure_node']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/261 | Question: There is an m x n binary **grid**, where 1 represents a brick and 0 represents a blank. The premise for a brick to be stable (not falling) is: a brick is directly connected to the top of the grid, or at least one adjacent (one of the four directions) brick is stable and will not fall. Given an array **hits**,... | [
"assert candidate([[1,0,0,0],[1,1,1,0]],[[1,0]])==[2]",
"assert candidate([[1,0,0,0],[1,1,0,0]],[[1,1],[1,0]])==[0,0]"
] | def test_run(content1,content2):
return SN_NBS(content1,content2).Number_bricks() | test_run | assert candidate([['class NBS', 'class SN_NBS(NBS)', 'super().__init__(grid)', 'def Number_bricks']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/262 | Question: Given an integer array **nums**. Move each element in the **nums** array to array **A** or array **B**, ensuring that arrays **A** and **B** are not empty, and average(A) == average(B). If it can be completed, return True, otherwise return False;
Based on the above question, please create a class **EMT** in P... | [
"assert candidate([1,2,3,4,5,6,7,8])==True",
"assert candidate([3,1])==False"
] | def test_run(content1):
return SN_EMT(content1).Element_Movement() | test_run | assert candidate([['class EMT', 'class SN_EMT(EMT)', 'super().__init__(nums)', 'def Element_Movement']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/263 | Question: Given an array **nums** and an integer **k**. We divide the given array **nums** into at most **k** non-empty subarrays, and the array is continuous. The score is composed of the sum of the averages within each subarray. Return the maximum score that can be obtained;
Based on the above question, use Python la... | [
"assert candidate([9,1,2,3,9],3)==20.00000",
"assert candidate([1,2,3,4,5,6,7],4)==20.50000"
] | def test_run(content1,content2):
return SN_MSE(content1,content2).Maximum_score() | test_run | assert candidate([['class MSE', 'class SN_MSE(MSE)', 'super().__init__(nums)', 'def Maximum_score']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/264 | Question: Given an array **routes**, representing a series of bus routes, where each routes[i] represents a bus route, the i-th bus will circulate on it. For example, the route routes[0]=[1,5,7] indicates that the 0-th bus will always travel in the sequence of 1->5->7->1->5->7->1->... Now starting from the **source** s... | [
"assert candidate([[1,2,7],[3,6,7]],1,6)==2",
"assert candidate([[7,12],[4,5,15],[6],[15,19],[9,12,13]],15,12)==-1"
] | def test_run(content1,content2,content3):
return SN_TSN(content1,content2,content3).Terminal_Station() | test_run | assert candidate([['class TSN', 'class SN_TSN(TSN)', 'super().__init__(routes)', 'def Terminal_Station']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/265 | Question: There are some two-dimensional coordinates, such as (1,3) or (2,0.5), and then we remove all commas, decimal points, and spaces to get a string **S**. Return all possible original strings to a list. The original coordinate notation will not have extra zeros, so there will be no **00**, **0.0**, **0.00**, **1.... | [
"assert candidate(\"(123)\")==[\"(1, 23)\", \"(12, 3)\", \"(1.2, 3)\", \"(1, 2.3)\"]",
"assert candidate(\"(00011)\")==[\"(0.001, 1)\", \"(0, 0.011)\"]",
"assert candidate(\"(0123)\")==[\"(0, 123)\", \"(0, 12.3)\", \"(0, 1.23)\", \"(0.1, 23)\", \"(0.1, 2.3)\", \"(0.12, 3)\"]",
"assert candidate(\"(100)\")==[(... | def test_run(content1):
return SN_AOR(content1).Any_order() | test_run | assert candidate([['class AOR', 'class SN_AOR(AOR)', 'super().__init__(s)', 'def Any_order']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/266 | Question: The valid encoding of the word array **words** consists of any mnemonic string **s** and index array **indices**, and meets the following requirements:
1. words.length == indices.length
2. The mnemonic string **s** ends with the character '#'
3. For each index indices[i], a substring of **s** that starts from... | [
"assert candidate([\"time\", \"me\", \"bell\"])==10",
"assert candidate([\"t\"])==2"
] | def test_run(content1):
return SN_ECG(content1).efficient_coding() | test_run | assert candidate([['class ECG', 'class SN_ECG(ECG)', 'super().__init__(words)', 'def efficient_coding']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/267 | Question: Given a string **s** and a character **c**, where **c** is a character that appears in **s**. Return an integer array **answer**, where answer.length == s.length and answer[i] is the distance from index **i** in **s** to the nearest character **c**;
Based on the above question, please create a class **CDC** i... | [
"assert candidate(\"loveleetcode\",\"e\")==[3,2,1,0,1,0,0,1,2,2,1,0]",
"assert candidate(\"aaab\",\"b\")==[3,2,1,0]"
] | def test_run(content1,content2):
return SN_CDC(content1,content2).Character_distance() | test_run | assert candidate([['class CDC', 'class SN_CDC(CDC)', 'super().__init__(s)', 'def Character_distance']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/268 | Question: Given an array **arr** containing non-repeating integer elements, each integer arr[i] is greater than 1. Use these integers to construct a binary tree, each integer can be used any number of times. Where: the value of each non-leaf node should be equal to the product of the values of its two child nodes. How ... | [
"assert candidate([2, 4])==3",
"assert candidate([2, 4, 5, 10])==7"
] | def test_run(content1):
return SN_RIR(content1).repeating_integer() | test_run | assert candidate([['class RIR', 'class SN_RIR(RIR)', 'super().__init__(arr)', 'def repeating_integer']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/269 | Question: You have **n** jobs and **m** workers. Given three arrays: **difficulty**, **profit**, and **worker**, where: difficulty[i] represents the difficulty of the i-th job, profit[i] represents the profit of the i-th job. **worker[i]** is the ability of the i-th worker, that is, the worker can only complete jobs wi... | [
"assert candidate([2,4,6,8,10],[10,20,30,40,50],[4,5,6,7])==100",
"assert candidate([85,47,57],[24,66,99],[40,25,25])==0"
] | def test_run(content1,content2,content3):
return SN_MPT(content1,content2,content3).Maximum_profit() | test_run | assert candidate([['class MPT', 'class SN_MPT(MPT)', 'super().__init__(difficulty)', 'def Maximum_profit']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/270 | Question: Given a binary matrix **grid** of size n x n. You are allowed to change at most one 0 to 1. Return the maximum area of an island in the **grid** after this operation;
Please create a class **IAA** in Python based on the above question, with the attribute **grid**. Then create a class **SN_IAA** that inherits ... | [
"assert candidate([[1, 0], [0, 1]])==3",
"assert candidate([[1, 1], [1, 0]])==4",
"assert candidate([[1, 1], [1, 1]])==4"
] | def test_run(content1):
return SN_IAA(content1).Island_area() | test_run | assert candidate([['class IAA', 'class SN_IAA(IAA)', 'super().__init__(grid)', 'def Island_area']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/271 | Question: Define a function **countUniqueChars** to count the unique characters in string **s**, and return the number of unique characters;
Based on the above question, please create a class **UCR** in Python language with the attribute **s**; then create another class **SN_UCR** that inherits from the **UCR** class, ... | [
"assert candidate(\"ABC\")==10",
"assert candidate(\"ABA\")==8",
"assert candidate(\"LEETCODE\")==92"
] | def test_run(content1):
return SN_UCR(content1).Unique_character() | test_run | assert candidate([['class UCR', 'class SN_UCR(UCR)', 'super().__init__(s)', 'def Unique_character']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/272 | Question: Given a positive integer **n**, return the number of groups of consecutive positive integers that satisfy the sum of all numbers equals **n**;
Based on the above question, please create a class **SNS** in Python, which has an attribute **n**. Then create another class **SN_SNS** that inherits from the **SNS**... | [
"assert candidate(5)==2",
"assert candidate(9)==3",
"assert candidate(15)==5"
] | def test_run(content1):
return SN_SNS(content1).Sum_Numbers() | test_run | assert candidate([['class SNS', 'class SN_SNS(SNS)', 'super().__init__(n)', 'def Sum_Numbers']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/273 | Question: Given an undirected, connected tree. The tree has **n** nodes labeled from 0 to n-1 and n-1 edges. Given an integer **n** and an array **edges**, edges[i] = [a_i, b_i] indicates that there is an edge between nodes a_i and b_i in the tree. Return an array answer of length **n**, where answer[i] is the sum of t... | [
"assert candidate(6,[[0,1],[0,2],[2,3],[2,4],[2,5]])==[8,12,6,10,10,10]",
"assert candidate(1,[])==[0]",
"assert candidate(2,[[1,0]])==[1,1]"
] | def test_run(content1,content2):
return SN_SDC(content1,content2).Sum_distances() | test_run | assert candidate([['class SDC', 'class SN_SDC(SDC)', 'super().__init__(n)', 'def Sum_distances']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/274 | Question: Given two images **img1** and **img2**, both of which are n x n in size and represented by binary square matrices of the same size. The binary matrix is composed only of several 0s and 1s. Transform one of the images by sliding all the 1s to the left, right, up, or down by any number of units; then place it o... | [
"assert candidate([[1,1,0],[0,1,0],[0,1,0]],[[0,0,0],[0,1,1],[0,0,1]])==3",
"assert candidate([[1]],[[1]])==1",
"assert candidate([[0]],[[0]])==0"
] | def test_run(content1,content2):
return SN_OQT(content1,content2).Overlap_quantity() | test_run | assert candidate([['class OQT', 'class SN_OQT(OQT)', 'super().__init__(img1)', 'def Overlap_quantity']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/275 | Question: A rectangle is represented as a list [x1,y1,x2,y2], where (x1,y1) is the coordinate of the bottom left corner, and (x2,y2) is the coordinate of the top right corner. The top and bottom edges of the rectangle are parallel to the x-axis, and the left and right edges are parallel to the y-axis. If the intersecti... | [
"assert candidate([0,0,2,2],[1,1,3,3])==True",
"assert candidate([0,0,1,1],[1,0,2,1])==False",
"assert candidate([0,0,1,1],[2,2,3,3])==False"
] | def test_run(content1,content2):
return SN_ROP(content1,content2).Rectangle_overlap() | test_run | assert candidate([['class ROP', 'class SN_ROP(ROP)', 'super().__init__(rec1)', 'def Rectangle_overlap']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/276 | Question: Alice participates in a game roughly based on the rules of the card game **Blackjack**, described as follows: Alice starts with 0 points, and draws numbers when her score is less than k points. When drawing, she randomly gets an integer from the range [1, maxPts] to accumulate as a score, where **maxPts** is ... | [
"assert candidate(10,1,10)==1.00000",
"assert candidate(6,1,10)==0.60000",
"assert candidate(21,17,10)==0.73278"
] | def test_run(content1,content2,content3):
return SN_ENS(content1,content2,content3).Extract_Numbers() | test_run | assert candidate([['class ENS', 'class SN_ENS(ENS)', 'super().__init__(n)', 'def Extract_Numbers']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/277 | Question: If two different positions in string **X** are swapped to make it equal to string **Y**, then **X** and **Y** are considered similar. If the two strings are identical, they are also similar. Given a list of strings **strs**, each string in the list is an anagram of all other strings in **strs**. How many simi... | [
"assert candidate([\"tars\",\"rats\",\"arts\",\"star\"])==2",
"assert candidate([\"omv\",\"ovm\"])==1"
] | def test_run(content1):
return SN_SST(content1).Similar_Strings() | test_run | assert candidate([['class SST', 'class SN_SST(SST)', 'super().__init__(strs)', 'def Similar_Strings']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/278 | Question: A 3x3 magic square is a 3x3 matrix filled with distinct numbers from 1 to 9, where the sum of each row, each column, and the two diagonals are equal. Given a grid of row x col composed of integers, how many 3x3 **magic square** submatrices are there? (Each submatrix is continuous);
Based on the above question... | [
"assert candidate([[4,3,8,4],[9,5,1,9],[2,7,6,2]])==1",
"assert candidate([[8]])==0"
] | def test_run(content1):
return SN_SAX(content1).submatrix() | test_run | assert candidate([['class SAX', 'class SN_SAX(SAX)', 'super().__init__(grid)', 'def submatrix']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/279 | Question: There are **n** rooms, numbered from 0 to n-1. Initially, all rooms except room 0 are locked. Your goal is to enter all rooms. However, you cannot enter a locked room without obtaining the key. When you enter a room, you may find a set of different keys inside, each key has a corresponding room number, indica... | [
"assert candidate([[1],[2],[3],[]])==True",
"assert candidate([[1,3],[3,0,1],[2],[0]])==False"
] | def test_run(content1):
return SN_ARS(content1).All_rooms() | test_run | assert candidate([['class ARS', 'class SN_ARS(ARS)', 'super().__init__(rooms)', 'def All_rooms']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/280 | Question: Given a string of digits **num**, such as "123456579", we can split it into a Fibonacci-like sequence [123,456,579]. Formally, a Fibonacci-like sequence is a list of non-negative integers **f**, satisfying:
1. 0<=f[i]<231, (in other words, each integer conforms to the 32-bit signed integer type). 2. f.length>... | [
"assert candidate(\"1101111\")==[11,0,11,11]",
"assert candidate(\"112358130\")==[]",
"assert candidate(\"0123\")==[]"
] | def test_run(content1):
return SN_FEQ(content1).Fibonacci_equation() | test_run | assert candidate([['class FEQ', 'class SN_FEQ(FEQ)', 'super().__init__(num)', 'def Fibonacci_equation']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/281 | Question: An array arr is called a mountain array if it meets the following properties:
1. arr.length>=3. 2. There exists an index **i** (0<i<arr.length-1), such that arr[0]<arr[1]<...<arr[i-1]<arr[i] and arr[i]>arr[i+1]>...>arr[arr.length-1]. Given an integer array **arr**, return the length of the longest mountain su... | [
"assert candidate([2,1,4,7,3,2,5])==5",
"assert candidate([2,2,2])==0"
] | def test_run(content1):
return SN_LMN(content1).Longest_mountain() | test_run | assert candidate([['class LMN', 'class SN_LMN(LMN)', 'super().__init__(arr)', 'def Longest_mountain']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/282 | Question: Alice has a deck of cards in her hand. She wants to rearrange these cards into several groups, each with a group size of **groupSize**, and each group consists of **groupSize** consecutive cards. You are given an integer array **hand** where hand[i] is the value written on the i-th card. If she can rearrange ... | [
"assert candidate([1,2,3,6,2,3,4,7,8],3)==True",
"assert candidate([1,2,3,4,5],4)==False"
] | def test_run(content1,content2):
return SN_RRG(content1,content2).rearrange() | test_run | assert candidate([['class RRG', 'class SN_RRG(RRG)', 'super().__init__(hand)', 'def rearrange']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/283 | Question: There exists an undirected connected graph composed of **n** nodes, with the nodes numbered from 0 to n-1. A given array **graph** represents this graph. In it, graph[i] is a list, composed of all nodes directly connected to node **i**. Return the length of the shortest path that can visit all nodes. You can ... | [
"assert candidate([[1,2,3],[0],[0],[0]])==4",
"assert candidate([[1],[0,2,4],[1,3,4],[2],[1,2]])==4"
] | def test_run(content1):
return SN_TTH(content1).The_length() | test_run | assert candidate([['class TTH', 'class SN_TTH(TTH)', 'super().__init__(graph)', 'def The_length']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/284 | Question: There is a string **s** composed of lowercase letters, and an integer array **shifts** of the same length. We call the next letter in the alphabet a **shift** of the original letter (since the alphabet is circular, 'z' will become 'a'). Return the final string obtained after applying all these shifts to **s**... | [
"assert candidate(\"abc\",[3,5,9])==\"rpl\"",
"assert candidate(\"aaa\",[1,2,3])==\"gfd\""
] | def test_run(content1,content2):
return SN_SAN(content1,content2).Shift_application() | test_run | assert candidate([['class SAN', 'class SN_SAN(SAN)', 'super().__init__(s)', 'def Shift_application']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/285 | Question: Given an array **seats** representing a row of seats, where seats[i]=1 means someone is sitting in the i-th seat, and seats[i]=0 means the i-th seat is empty (index starts from 0). There is at least one empty seat, and at least one person is already sitting. Alex wants to sit in a seat that maximizes the dist... | [
"assert candidate([1,0,0,0,1,0,1])==2",
"assert candidate([1,0,0,0])==3",
"assert candidate([0,1])==1"
] | def test_run(content1):
return SN_ASG(content1).Maximized_seating() | test_run | assert candidate([['class ASG', 'class SN_ASG(ASG)', 'super().__init__(seats)', 'def Maximized_seating']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/286 | Question: Given an axis-aligned 2D array **rectangles**. For rectangle[i]=[x1,y1,x2,y2], where (x1,y1) are the coordinates of the bottom left corner of rectangle **i**, (x_i1,y_i1) are the coordinates of the bottom left corner of the rectangle, and (x_i2,y_i2) are the coordinates of the top right corner of the rectangl... | [
"assert candidate([[0,0,2,2],[1,0,2,3],[1,0,3,1]])==6",
"assert candidate([[0,0,1000000000,1000000000]])==49"
] | def test_run(content1):
return SN_TAR(content1).total_area() | test_run | assert candidate([['class TAR', 'class SN_TAR(TAR)', 'super().__init__(rectangles)', 'def total_area']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/287 | Question: For some non-negative integers **k**, if swapping the positions of two letters in **s1** exactly **k** times can result in a string equal to **s2**, then the similarity of strings **s1** and **s2** is considered to be **k**. Given two anagrams s1 and s2, return the minimum value of the similarity **k** betwee... | [
"assert candidate(\"ab\",\"ba\")==1",
"assert candidate(\"abc\",\"bca\")==2"
] | def test_run(content1,content2):
return SN_MVE(content1,content2).Minimum_value() | test_run | assert candidate([['class MVE', 'class SN_MVE(MVE)', 'super().__init__(s1)', 'def Minimum_value']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/288 | Question: Given a balanced parentheses string **S**, calculate the score of the string according to the following rules:
1. **()** gets 1 point. 2. **AB** gets A+B points, where A and B are balanced parentheses strings. 3. **(A)** gets 2*A points, where A is a balanced parentheses string.
Based on the above question, p... | [
"assert candidate(\"()\")==1",
"assert candidate(\"(())\")==2",
"assert candidate(\"()()\")==2",
"assert candidate(\"(()(()))\")==6"
] | def test_run(content1):
return SN_BPS(content1).Balanced_parentheses() | test_run | assert candidate([['class BPS', 'class SN_BPS(BPS)', 'super().__init__(S)', 'def Balanced_parentheses']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/289 | Question: There is a special **square room**, each wall of which has a mirror. Except for the **southwest corner**, there is a receiver in each corner, numbered as 0, 1, and 2. The length of the wall of the square room is **p**, a laser beam is emitted from the southwest corner, and it will first meet the east wall. Th... | [
"assert candidate(2,1)==2",
"assert candidate(3,1)==1"
] | def test_run(content1,content2):
return SN_RNE(content1,content2).Receiver_number() | test_run | assert candidate([['class RNE', 'class SN_RNE(RNE)', 'super().__init__(p)', 'def Receiver_number']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/290 | Question: Given a binary matrix **grid** of size m x n, where each element in the matrix is either 0 or 1. A move is defined as choosing any row or column and flipping the values in that row or column: change all 0s to 1s and all 1s to 0s. After making any number of moves, the score of the matrix is the sum of the numb... | [
"assert candidate([[0,0,1,1],[1,0,1,0],[1,1,0,0]])==39",
"assert candidate([[0]])==1"
] | def test_run(content1):
return SN_HSE(content1).Highest_Score() | test_run | assert candidate([['class HSE', 'class SN_HSE(HSE)', 'super().__init__(grid)', 'def Highest_Score']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/291 | Question: Given an integer array **nums** and an integer **k**, find the shortest non-empty subarray in **nums** whose sum is at least **k**, and return the length of this subarray. If such a subarray does not exist, return -1;
Based on the above question, create a class **SEY** in Python, which has the attribute **num... | [
"assert candidate([1],1)==1",
"assert candidate([1,2],4)==-1",
"assert candidate([2,-1,2],3)==3"
] | def test_run(content1,content2):
return SN_SEY(content1,content2).Shortest_empty() | test_run | assert candidate([['class SEY', 'class SN_SEY(SEY)', 'super().__init__(nums)', 'def Shortest_empty']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/292 | Question: Find the smallest palindrome prime number that is greater than or equal to **N**;
Based on the above question, please create a class **PPM** in Python with an attribute **N**. Then, create another class **SN_PPM** that inherits from the **PPM** class, and add a public function **prime_palindromes** to return ... | [
"assert candidate(6)==7",
"assert candidate(8)==11",
"assert candidate(13)==101"
] | def test_run(content1):
return SN_PPM(content1).prime_palindromes() | test_run | assert candidate([['class PPM', 'class SN_PPM(PPM)', 'super().__init__(N)', 'def prime_palindromes']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/293 | Question: Given a positive integer **n**, we reorder the digits in any order (including the original order), noting that the leading digit cannot be zero. If we can obtain a power of 2 in this way, return True; otherwise, return False;
Based on the above question, please create a class **NRG** in Python with the attrib... | [
"assert candidate(1)==True",
"assert candidate(10)==False"
] | def test_run(content1):
return SN_NRG(content1).Number_Reordering() | test_run | assert candidate([['class NRG', 'class SN_NRG(NRG)', 'super().__init__(n)', 'def Number_Reordering']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/294 | Question: Given two arrays of equal length, **nums1** and **nums2**, the advantage of **nums1** over **nums2** can be described by the number of indices **i** for which nums1[i] > nums2[i]. Return any permutation of **nums1** that maximizes its advantage over **nums2**;
Based on the above question, create a class **MAS... | [
"assert candidate([2,7,11,15],[1,10,4,11])==[2,11,7,15]",
"assert candidate([12,24,8,32],[13,25,32,11])==[24,32,8,12]"
] | def test_run(content1,content2):
return SN_MAS(content1,content2).Maximizing_Advantages() | test_run | assert candidate([['class MAS', 'class SN_MAS(MAS)', 'super().__init__(nums1)', 'def Maximizing_Advantages']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/295 | Question: If a sequence X_1, X_2, ..., X_n satisfies the following conditions, it is said to be **Fibonacci-like**:
1. n>=3. 2. For all i+2<=n, we have X_i+X_{i+1}=X_{i+2}. Given a strictly increasing positive integer array forming a sequence **arr**, find the length of the longest Fibonacci-like subsequence in **arr**... | [
"assert candidate([1,2,3,4,5,6,7,8])==5",
"assert candidate([1,3,7,11,12,14,18])==3"
] | def test_run(content1):
return SN_PAY(content1).Positive_array() | test_run | assert candidate([['class PAY', 'class SN_PAY(PAY)', 'super().__init__(arr)', 'def Positive_array']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/296 | Question: Koko loves to eat bananas. There are **n** piles of bananas here, and the i-th pile has piles[i] bananas. The guard has already left and will return in **h** hours. Koko can decide her eating speed **k** (unit: bananas/hour). Every hour, she will choose a pile of bananas and eat **k** bananas from it. If this... | [
"assert candidate([3,6,7,11],8)==4",
"assert candidate([30,11,23,4,20],5)==30",
"assert candidate([30,11,23,4,20],6)==23"
] | def test_run(content1,content2):
return SN_MSD(content1,content2).Minimum_Speed() | test_run | assert candidate([['class MSD', 'class SN_MSD(MSD)', 'super().__init__(piles)', 'def Minimum_Speed']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/297 | Question: A positive integer is magical if it can be divided by **a** or **b**. Given three integers **n**, **a**, **b**, return the n-th magical number;
Based on the above question, create a class **MNS** in Python with the attribute **n**; then create another class **SN_MNS** that inherits from the **MNS** class, and... | [
"assert candidate(1,2,3)==2",
"assert candidate(4,2,3)==6"
] | def test_run(content1,content2,content3):
return SN_MNS(content1,content2,content3).Magical_Numbers() | test_run | assert candidate([['class MNS', 'class SN_MNS(MNS)', 'super().__init__(n)', 'def Magical_Numbers']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/298 | Question: There are **n** employees in the group, who can complete various jobs to generate profits. The i-th job will generate a profit of profit[i], and it requires group[i] members to participate together. If a member participates in one job, he/she cannot participate in another job. Any subset of jobs that generate... | [
"assert candidate(5,3,[2,2],[2,3])==2",
"assert candidate(10,5,[2,3,5],[6,7,8])==7"
] | def test_run(content1,content2,content3,content4):
return SN_PPN(content1,content2,content3,content4).Profit_Plan() | test_run | assert candidate([['class PPN', 'class SN_PPN(PPN)', 'super().__init__(n)', 'def Profit_Plan']]) == True | def matching_function(content):
def run_match(text):
for task in text:
if task not in str_content:
return False
return True
len_cont = len(content)
if len_cont==1 and run_match(content[0]) == True:
return True
elif (len_cont==2 and run_match(content[0]... |
OOP/299 | Question: Given an encoded string **S**. You are asked to find the decoded string and write it onto a tape. During the decoding process, read one character from the encoded string at a time, and take the following steps:
1. If the character read is a letter, write it on the tape. 2. If the character read is a number (s... | [
"assert candidate(\"leet2code3\",10)==\"o\"",
"assert candidate(\"ha22\",5)==\"h\"",
"assert candidate(\"a2345678999999999999999\",1)==\"a\""
] | def test_run(content1,content2):
return SN_DSG(content1,content2).Decode_String() | test_run | assert candidate([['class DSG', 'class SN_DSG(DSG)', 'super().__init__(S)', 'def Decode_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]... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.