question
stringlengths 104
2.09k
| test_list
listlengths 3
3
| test_time_limit
int64 1
1
| test_method
stringclasses 1
value | prefix
stringclasses 1
value |
|---|---|---|---|---|
Write a python function to set the left most unset bit.
Your code should pass the test:
assert set_left_most_unset_bit(10) == 14
|
[
"assert set_left_most_unset_bit(10) == 14",
"assert set_left_most_unset_bit(12) == 14",
"assert set_left_most_unset_bit(15) == 15"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to find the volume of a cone.
Your code should pass the test:
assert volume_cone(5,12)==314.15926535897927
|
[
"assert volume_cone(5,12)==314.15926535897927",
"assert volume_cone(10,15)==1570.7963267948965",
"assert volume_cone(19,17)==6426.651371693521"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a python function to print positive numbers in a list.
Your code should pass the test:
assert pos_nos([-1,-2,1,2]) == 1,2
|
[
"assert pos_nos([-1,-2,1,2]) == 1,2",
"assert pos_nos([3,4,-5]) == 3,4",
"assert pos_nos([-2,-3,1]) == 1"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to find out the maximum sum such that no two chosen numbers are adjacent for the given rectangular grid of dimension 2 x n.
Your code should pass the test:
assert max_sum_rectangular_grid([ [1, 4, 5], [2, 0, 0 ] ], 3) == 7
|
[
"assert max_sum_rectangular_grid([ [1, 4, 5], [2, 0, 0 ] ], 3) == 7",
"assert max_sum_rectangular_grid([ [ 1, 2, 3, 4, 5], [ 6, 7, 8, 9, 10] ], 5) == 24",
"assert max_sum_rectangular_grid([ [7, 9, 11, 15, 19], [21, 25, 28, 31, 32] ], 5) == 81"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a python function to find the first maximum length of even word.
Your code should pass the test:
assert find_Max_Len_Even("python language") == "language"
|
[
"assert find_Max_Len_Even(\"python language\") == \"language\"",
"assert find_Max_Len_Even(\"maximum even length\") == \"length\"",
"assert find_Max_Len_Even(\"eve\") == \"-1\""
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to find the index of the last occurrence of a given number in a sorted array.
Your code should pass the test:
assert find_last_occurrence([2, 5, 5, 5, 6, 6, 8, 9, 9, 9], 5) == 3
|
[
"assert find_last_occurrence([2, 5, 5, 5, 6, 6, 8, 9, 9, 9], 5) == 3",
"assert find_last_occurrence([2, 3, 5, 8, 6, 6, 8, 9, 9, 9], 9) == 9",
"assert find_last_occurrence([2, 2, 1, 5, 6, 6, 6, 9, 9, 9], 6) == 6"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to reflect the modified run-length encoding from a list.
Your code should pass the test:
assert modified_encode([1,1,2,3,4,4,5,1])==[[2, 1], 2, 3, [2, 4], 5, 1]
|
[
"assert modified_encode([1,1,2,3,4,4,5,1])==[[2, 1], 2, 3, [2, 4], 5, 1]",
"assert modified_encode('automatically')==['a', 'u', 't', 'o', 'm', 'a', 't', 'i', 'c', 'a', [2, 'l'], 'y']",
"assert modified_encode('python')==['p', 'y', 't', 'h', 'o', 'n']"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a python function to find the maximum volume of a cuboid with given sum of sides.
Your code should pass the test:
assert max_volume(8) == 18
|
[
"assert max_volume(8) == 18",
"assert max_volume(4) == 2",
"assert max_volume(1) == 0"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to find all five characters long word in the given string by using regex.
Your code should pass the test:
assert find_long_word('Please move back to strem') == ['strem']
|
[
"assert find_long_word('Please move back to strem') == ['strem']",
"assert find_long_word('4K Ultra HD streaming player') == ['Ultra']",
"assert find_long_word('Streaming Media Player') == ['Media']"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to calculate the difference between the squared sum of first n natural numbers and the sum of squared first n natural numbers.
Your code should pass the test:
assert sum_difference(12)==5434
|
[
"assert sum_difference(12)==5434",
"assert sum_difference(20)==41230",
"assert sum_difference(54)==2151270"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to find the demlo number for the given number.
Your code should pass the test:
assert find_demlo("111111") == '12345654321'
|
[
"assert find_demlo(\"111111\") == '12345654321'",
"assert find_demlo(\"1111\") == '1234321'",
"assert find_demlo(\"13333122222\") == '123456789101110987654321'"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to find all index positions of the minimum values in a given list.
Your code should pass the test:
assert position_min([12,33,23,10,67,89,45,667,23,12,11,10,54])==[3,11]
|
[
"assert position_min([12,33,23,10,67,89,45,667,23,12,11,10,54])==[3,11]",
"assert position_min([1,2,2,2,4,4,4,5,5,5,5])==[0]",
"assert position_min([2,1,5,6,8,3,4,9,10,11,8,12])==[1]"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to re-arrange the given array in alternating positive and negative items.
Your code should pass the test:
assert re_arrange([-5, -2, 5, 2, 4, 7, 1, 8, 0, -8], 10) == [-5, 5, -2, 2, -8, 4, 7, 1, 8, 0]
|
[
"assert re_arrange([-5, -2, 5, 2, 4,\t7, 1, 8, 0, -8], 10) == [-5, 5, -2, 2, -8, 4, 7, 1, 8, 0]",
"assert re_arrange([1, 2, 3, -4, -1, 4], 6) == [-4, 1, -1, 2, 3, 4]",
"assert re_arrange([4, 7, 9, 77, -4, 5, -3, -9], 8) == [-4, 4, -3, 7, -9, 9, 77, 5]"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to extract the sum of alternate chains of tuples.
Your code should pass the test:
assert sum_of_alternates((5, 6, 3, 6, 10, 34)) == (46, 18)
|
[
"assert sum_of_alternates((5, 6, 3, 6, 10, 34)) == (46, 18)",
"assert sum_of_alternates((1, 2, 3, 4, 5)) == (6, 9)",
"assert sum_of_alternates((6, 7, 8, 9, 4, 5)) == (21, 18)"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a python function to find the minimum number of squares whose sum is equal to a given number.
Your code should pass the test:
assert get_Min_Squares(6) == 3
|
[
"assert get_Min_Squares(6) == 3",
"assert get_Min_Squares(2) == 2",
"assert get_Min_Squares(4) == 1"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to get the word with most number of occurrences in the given strings list.
Your code should pass the test:
assert most_occurrences(["UTS is best for RTF", "RTF love UTS", "UTS is best"] ) == 'UTS'
|
[
"assert most_occurrences([\"UTS is best for RTF\", \"RTF love UTS\", \"UTS is best\"] ) == 'UTS'",
"assert most_occurrences([\"Its been a great year\", \"this year is so worse\", \"this year is okay\"] ) == 'year'",
"assert most_occurrences([\"Families can be reunited\", \"people can be reunited\", \"Tasks can be achieved \"] ) == 'can'"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to print check if the triangle is isosceles or not.
Your code should pass the test:
assert check_isosceles(6,8,12)==False
|
[
"assert check_isosceles(6,8,12)==False ",
"assert check_isosceles(6,6,12)==True",
"assert check_isosceles(6,16,20)==False"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to rotate a given list by specified number of items to the left direction.
Your code should pass the test:
assert rotate_left([1, 2, 3, 4, 5, 6, 7, 8, 9, 10],3,4)==[4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4]
|
[
"assert rotate_left([1, 2, 3, 4, 5, 6, 7, 8, 9, 10],3,4)==[4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4]",
"assert rotate_left([1, 2, 3, 4, 5, 6, 7, 8, 9, 10],2,2)==[3, 4, 5, 6, 7, 8, 9, 10, 1, 2]",
"assert rotate_left([1, 2, 3, 4, 5, 6, 7, 8, 9, 10],5,2)==[6, 7, 8, 9, 10, 1, 2]"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a python function to count negative numbers in a list.
Your code should pass the test:
assert neg_count([-1,-2,3,-4,-5]) == 4
|
[
"assert neg_count([-1,-2,3,-4,-5]) == 4",
"assert neg_count([1,2,3]) == 0",
"assert neg_count([1,2,-3,-10,20]) == 2"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to find all three, four, five characters long words in the given string by using regex.
Your code should pass the test:
assert find_char('For the four consumer complaints contact manager AKR reddy') == ['For', 'the', 'four', 'AKR', 'reddy']
|
[
"assert find_char('For the four consumer complaints contact manager AKR reddy') == ['For', 'the', 'four', 'AKR', 'reddy']",
"assert find_char('Certain service are subject to change MSR') == ['are', 'MSR']",
"assert find_char('Third party legal desclaimers') == ['Third', 'party', 'legal']"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a python function to count unset bits of a given number.
Your code should pass the test:
assert count_unset_bits(2) == 1
|
[
"assert count_unset_bits(2) == 1",
"assert count_unset_bits(4) == 2",
"assert count_unset_bits(6) == 1"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to count character frequency of a given string.
Your code should pass the test:
assert char_frequency('python')=={'p': 1, 'y': 1, 't': 1, 'h': 1, 'o': 1, 'n': 1}
|
[
"assert char_frequency('python')=={'p': 1, 'y': 1, 't': 1, 'h': 1, 'o': 1, 'n': 1}",
"assert char_frequency('program')=={'p': 1, 'r': 2, 'o': 1, 'g': 1, 'a': 1, 'm': 1}",
"assert char_frequency('language')=={'l': 1, 'a': 2, 'n': 1, 'g': 2, 'u': 1, 'e': 1}"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a python function to sort a list according to the second element in sublist.
Your code should pass the test:
assert Sort([['a', 10], ['b', 5], ['c', 20], ['d', 15]]) == [['b', 5], ['a', 10], ['d', 15], ['c', 20]]
|
[
"assert Sort([['a', 10], ['b', 5], ['c', 20], ['d', 15]]) == [['b', 5], ['a', 10], ['d', 15], ['c', 20]]",
"assert Sort([['452', 10], ['256', 5], ['100', 20], ['135', 15]]) == [['256', 5], ['452', 10], ['135', 15], ['100', 20]]",
"assert Sort([['rishi', 10], ['akhil', 5], ['ramya', 20], ['gaur', 15]]) == [['akhil', 5], ['rishi', 10], ['gaur', 15], ['ramya', 20]]"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a python function to check whether the triangle is valid or not if sides are given.
Your code should pass the test:
assert check_Validity(1,2,3) == False
|
[
"assert check_Validity(1,2,3) == False",
"assert check_Validity(2,3,5) == False",
"assert check_Validity(7,10,5) == True"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to find the sum of arithmetic progression.
Your code should pass the test:
assert ap_sum(1,5,2)==25
|
[
"assert ap_sum(1,5,2)==25",
"assert ap_sum(2,6,4)==72",
"assert ap_sum(1,4,5)==34"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to check whether the given month name contains 28 days or not.
Your code should pass the test:
assert check_monthnum("February")==True
|
[
"assert check_monthnum(\"February\")==True",
"assert check_monthnum(\"January\")==False",
"assert check_monthnum(\"March\")==False"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function that matches a word at the end of a string, with optional punctuation.
Your code should pass the test:
assert text_match_word("python.")==('Found a match!')
|
[
"assert text_match_word(\"python.\")==('Found a match!')",
"assert text_match_word(\"python.\")==('Found a match!')",
"assert text_match_word(\" lang .\")==('Not matched!')"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a python function to count the number of substrings with same first and last characters.
Your code should pass the test:
assert count_Substring_With_Equal_Ends('aba') == 4
|
[
"assert count_Substring_With_Equal_Ends('aba') == 4",
"assert count_Substring_With_Equal_Ends('abcab') == 7",
"assert count_Substring_With_Equal_Ends('abc') == 3"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a python function to find the maximum occuring divisor in an interval.
Your code should pass the test:
assert find_Divisor(2,2) == 2
|
[
"assert find_Divisor(2,2) == 2",
"assert find_Divisor(2,5) == 2",
"assert find_Divisor(5,10) == 2"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a python function to find the sum of the three lowest positive numbers from a given list of numbers.
Your code should pass the test:
assert sum_three_smallest_nums([10,20,30,40,50,60,7]) == 37
|
[
"assert sum_three_smallest_nums([10,20,30,40,50,60,7]) == 37",
"assert sum_three_smallest_nums([1,2,3,4,5]) == 6",
"assert sum_three_smallest_nums([0,1,2,3,4,5]) == 6"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to convert the given set into ordered tuples.
Your code should pass the test:
assert set_to_tuple({1, 2, 3, 4, 5}) == (1, 2, 3, 4, 5)
|
[
"assert set_to_tuple({1, 2, 3, 4, 5}) == (1, 2, 3, 4, 5)",
"assert set_to_tuple({6, 7, 8, 9, 10, 11}) == (6, 7, 8, 9, 10, 11)",
"assert set_to_tuple({12, 13, 14, 15, 16}) == (12, 13, 14, 15, 16)"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to find the smallest range that includes at-least one element from each of the given arrays.
Your code should pass the test:
assert find_minimum_range([[3, 6, 8, 10, 15], [1, 5, 12], [4, 8, 15, 16], [2, 6]]) == (4, 6)
|
[
"assert find_minimum_range([[3, 6, 8, 10, 15], [1, 5, 12], [4, 8, 15, 16], [2, 6]]) == (4, 6)",
"assert find_minimum_range([[ 2, 3, 4, 8, 10, 15 ], [1, 5, 12], [7, 8, 15, 16], [3, 6]]) == (4, 7)",
"assert find_minimum_range([[4, 7, 9, 11, 16], [2, 6, 13], [5, 9, 16, 17], [3, 7]]) == (5, 7)"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to calculate the number of digits and letters in a string.
Your code should pass the test:
assert dig_let("python")==(6,0)
|
[
"assert dig_let(\"python\")==(6,0)",
"assert dig_let(\"program\")==(7,0)",
"assert dig_let(\"python3.0\")==(6,2)"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a python function to find number of elements with odd factors in a given range.
Your code should pass the test:
assert count_Odd_Squares(5,100) == 8
|
[
"assert count_Odd_Squares(5,100) == 8",
"assert count_Odd_Squares(8,65) == 6",
"assert count_Odd_Squares(2,5) == 1"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to find the difference between two consecutive numbers in a given list.
Your code should pass the test:
assert diff_consecutivenums([1, 1, 3, 4, 4, 5, 6, 7])==[0, 2, 1, 0, 1, 1, 1]
|
[
"assert diff_consecutivenums([1, 1, 3, 4, 4, 5, 6, 7])==[0, 2, 1, 0, 1, 1, 1]",
"assert diff_consecutivenums([4, 5, 8, 9, 6, 10])==[1, 3, 1, -3, 4]",
"assert diff_consecutivenums([0, 1, 2, 3, 4, 4, 4, 4, 5, 7])==[1, 1, 1, 1, 0, 0, 0, 1, 2]"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to find entringer number e(n, k).
Your code should pass the test:
assert zigzag(4, 3) == 5
|
[
"assert zigzag(4, 3) == 5",
"assert zigzag(4, 2) == 4",
"assert zigzag(3, 1) == 1"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a python function to count the number of squares in a rectangle.
Your code should pass the test:
assert count_Squares(4,3) == 20
|
[
"assert count_Squares(4,3) == 20",
"assert count_Squares(1,2) == 2",
"assert count_Squares(2,2) == 5"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to count sequences of given length having non-negative prefix sums that can be generated by given values.
Your code should pass the test:
assert find_ways(4) == 2
|
[
"assert find_ways(4) == 2",
"assert find_ways(6) == 5",
"assert find_ways(8) == 14"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a python function to check whether the given string is a binary string or not.
Your code should pass the test:
assert check("01010101010") == "Yes"
|
[
"assert check(\"01010101010\") == \"Yes\"",
"assert check(\"name0\") == \"No\"",
"assert check(\"101\") == \"Yes\""
] | 1
|
function
|
Here is the completed code:
```python
|
Write a python function to minimize the length of the string by removing occurrence of only one character.
Your code should pass the test:
assert minimum_Length("mnm") == 1
|
[
"assert minimum_Length(\"mnm\") == 1",
"assert minimum_Length(\"abcda\") == 3",
"assert minimum_Length(\"abcb\") == 2"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a python function to find the first element occurring k times in a given array.
Your code should pass the test:
assert first_Element([0,1,2,3,4,5],6,1) == 0
|
[
"assert first_Element([0,1,2,3,4,5],6,1) == 0",
"assert first_Element([1,2,1,3,4],5,2) == 1",
"assert first_Element([2,3,4,3,5,7,1,2,3,5],10,2) == 2"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a python function to check whether all the characters in a given string are unique.
Your code should pass the test:
assert unique_Characters('aba') == False
|
[
"assert unique_Characters('aba') == False",
"assert unique_Characters('abc') == True",
"assert unique_Characters('abab') == False"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to remove a specified column from a given nested list.
Your code should pass the test:
assert remove_column([[1, 2, 3], [2, 4, 5], [1, 1, 1]],0)==[[2, 3], [4, 5], [1, 1]]
|
[
"assert remove_column([[1, 2, 3], [2, 4, 5], [1, 1, 1]],0)==[[2, 3], [4, 5], [1, 1]]",
"assert remove_column([[1, 2, 3], [-2, 4, -5], [1, -1, 1]],2)==[[1, 2], [-2, 4], [1, -1]]",
"assert remove_column([[1, 3], [5, 7], [1, 3], [13, 15, 17], [5, 7], [9, 11]],0)==[[3], [7], [3], [15, 17], [7], [11]]"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to find t-nth term of arithemetic progression.
Your code should pass the test:
assert tn_ap(1,5,2)==9
|
[
"assert tn_ap(1,5,2)==9",
"assert tn_ap(2,6,4)==22",
"assert tn_ap(1,4,5)==16"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a python function to count the number of rectangles in a circle of radius r.
Your code should pass the test:
assert count_Rectangles(2) == 8
|
[
"assert count_Rectangles(2) == 8",
"assert count_Rectangles(1) == 1",
"assert count_Rectangles(0) == 0"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to find the third angle of a triangle using two angles.
Your code should pass the test:
assert find_angle(47,89)==44
|
[
"assert find_angle(47,89)==44",
"assert find_angle(45,95)==40",
"assert find_angle(50,40)==90"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to find the maximum element of all the given tuple records.
Your code should pass the test:
assert find_max([(2, 4), (6, 7), (5, 1), (6, 10), (8, 7)]) == 10
|
[
"assert find_max([(2, 4), (6, 7), (5, 1), (6, 10), (8, 7)]) == 10",
"assert find_max([(3, 5), (7, 8), (6, 2), (7, 11), (9, 8)]) == 11",
"assert find_max([(4, 6), (8, 9), (7, 3), (8, 12), (10, 9)]) == 12"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to find modulo division of two lists using map and lambda function.
Your code should pass the test:
assert moddiv_list([4,5,6],[1, 2, 3])==[0, 1, 0]
|
[
"assert moddiv_list([4,5,6],[1, 2, 3])==[0, 1, 0]",
"assert moddiv_list([3,2],[1,4])==[0, 2]",
"assert moddiv_list([90,120],[50,70])==[40, 50]"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a python function to check whether one root of the quadratic equation is twice of the other or not.
Your code should pass the test:
assert Check_Solution(1,3,2) == "Yes"
|
[
"assert Check_Solution(1,3,2) == \"Yes\"",
"assert Check_Solution(1,2,3) == \"No\"",
"assert Check_Solution(1,-5,6) == \"No\""
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to find the n’th carol number.
Your code should pass the test:
assert get_carol(2) == 7
|
[
"assert get_carol(2) == 7",
"assert get_carol(4) == 223",
"assert get_carol(5) == 959"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to remove empty lists from a given list of lists.
Your code should pass the test:
assert remove_empty([[], [], [], 'Red', 'Green', [1,2], 'Blue', [], []])==['Red', 'Green', [1, 2], 'Blue']
|
[
"assert remove_empty([[], [], [], 'Red', 'Green', [1,2], 'Blue', [], []])==['Red', 'Green', [1, 2], 'Blue']",
"assert remove_empty([[], [], [],[],[], 'Green', [1,2], 'Blue', [], []])==[ 'Green', [1, 2], 'Blue']",
"assert remove_empty([[], [], [], 'Python',[],[], 'programming', 'language',[],[],[], [], []])==['Python', 'programming', 'language']"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a python function to find the item with maximum occurrences in a given list.
Your code should pass the test:
assert max_occurrences([1,2,3,1,2,3,12,4,2]) == 2
|
[
"assert max_occurrences([1,2,3,1,2,3,12,4,2]) == 2",
"assert max_occurrences([1,2,6,7,0,1,0,1,0]) == 1,0",
"assert max_occurrences([1,2,3,1,2,4,1]) == 1"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to add the k elements to each element in the tuple.
Your code should pass the test:
assert add_K_element([(1, 3, 4), (2, 4, 6), (3, 8, 1)], 4) == [(5, 7, 8), (6, 8, 10), (7, 12, 5)]
|
[
"assert add_K_element([(1, 3, 4), (2, 4, 6), (3, 8, 1)], 4) == [(5, 7, 8), (6, 8, 10), (7, 12, 5)]",
"assert add_K_element([(1, 2, 3), (4, 5, 6), (7, 8, 9)], 8) == [(9, 10, 11), (12, 13, 14), (15, 16, 17)]",
"assert add_K_element([(11, 12, 13), (14, 15, 16), (17, 18, 19)], 9) == [(20, 21, 22), (23, 24, 25), (26, 27, 28)]"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to find the number of flips required to make the given binary string a sequence of alternate characters.
Your code should pass the test:
assert min_flip_to_make_string_alternate("0001010111") == 2
|
[
"assert min_flip_to_make_string_alternate(\"0001010111\") == 2",
"assert min_flip_to_make_string_alternate(\"001\") == 1",
"assert min_flip_to_make_string_alternate(\"010111011\") == 2 "
] | 1
|
function
|
Here is the completed code:
```python
|
Write a python function to count the number of digits of a given number.
Your code should pass the test:
assert count_Digit(12345) == 5
|
[
"assert count_Digit(12345) == 5",
"assert count_Digit(11223305) == 8",
"assert count_Digit(4123459) == 7"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a python function to find the largest product of the pair of adjacent elements from a given list of integers.
Your code should pass the test:
assert adjacent_num_product([1,2,3,4,5,6]) == 30
|
[
"assert adjacent_num_product([1,2,3,4,5,6]) == 30",
"assert adjacent_num_product([1,2,3,4,5]) == 20",
"assert adjacent_num_product([2,3]) == 6"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to check if a binary tree is balanced or not.
Your code should pass the test:
assert is_tree_balanced(root) == False
|
[
"assert is_tree_balanced(root) == False",
"assert is_tree_balanced(root1) == True",
"assert is_tree_balanced(root2) == False "
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to repeat the given tuple n times.
Your code should pass the test:
assert repeat_tuples((1, 3), 4) == ((1, 3), (1, 3), (1, 3), (1, 3))
|
[
"assert repeat_tuples((1, 3), 4) == ((1, 3), (1, 3), (1, 3), (1, 3))",
"assert repeat_tuples((1, 2), 3) == ((1, 2), (1, 2), (1, 2))",
"assert repeat_tuples((3, 4), 5) == ((3, 4), (3, 4), (3, 4), (3, 4), (3, 4))"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to find the lateral surface area of cuboid
Your code should pass the test:
assert lateralsurface_cuboid(8,5,6)==156
|
[
"assert lateralsurface_cuboid(8,5,6)==156",
"assert lateralsurface_cuboid(7,9,10)==320",
"assert lateralsurface_cuboid(10,20,30)==1800"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to sort a tuple by its float element.
Your code should pass the test:
assert float_sort([('item1', '12.20'), ('item2', '15.10'), ('item3', '24.5')])==[('item3', '24.5'), ('item2', '15.10'), ('item1', '12.20')]
|
[
"assert float_sort([('item1', '12.20'), ('item2', '15.10'), ('item3', '24.5')])==[('item3', '24.5'), ('item2', '15.10'), ('item1', '12.20')] ",
"assert float_sort([('item1', '15'), ('item2', '10'), ('item3', '20')])==[('item3', '20'), ('item1', '15'), ('item2', '10')] ",
"assert float_sort([('item1', '5'), ('item2', '10'), ('item3', '14')])==[('item3', '14'), ('item2', '10'), ('item1', '5')] "
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to find the smallest missing element in a sorted array.
Your code should pass the test:
assert smallest_missing([0, 1, 2, 3, 4, 5, 6], 0, 6) == 7
|
[
"assert smallest_missing([0, 1, 2, 3, 4, 5, 6], 0, 6) == 7",
"assert smallest_missing([0, 1, 2, 6, 9, 11, 15], 0, 6) == 3",
"assert smallest_missing([1, 2, 3, 4, 6, 9, 11, 15], 0, 7) == 0"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to sort a given list of elements in ascending order using heap queue algorithm.
Your code should pass the test:
assert heap_assending([18, 14, 10, 9, 8, 7, 9, 3, 2, 4, 1])==[1, 2, 3, 4, 7, 8, 9, 9, 10, 14, 18]
|
[
"assert heap_assending([18, 14, 10, 9, 8, 7, 9, 3, 2, 4, 1])==[1, 2, 3, 4, 7, 8, 9, 9, 10, 14, 18]",
"assert heap_assending([25, 35, 22, 85, 14, 65, 75, 25, 58])==[14, 22, 25, 25, 35, 58, 65, 75, 85]",
"assert heap_assending([1, 3, 5, 7, 9, 2, 4, 6, 8, 0])==[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to find the volume of a cuboid.
Your code should pass the test:
assert volume_cuboid(1,2,3)==6
|
[
"assert volume_cuboid(1,2,3)==6",
"assert volume_cuboid(5,7,9)==315",
"assert volume_cuboid(10,15,21)==3150"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to print all permutations of a given string including duplicates.
Your code should pass the test:
assert permute_string('ab')==['ab', 'ba']
|
[
"assert permute_string('ab')==['ab', 'ba']",
"assert permute_string('abc')==['abc', 'bac', 'bca', 'acb', 'cab', 'cba']",
"assert permute_string('abcd')==['abcd', 'bacd', 'bcad', 'bcda', 'acbd', 'cabd', 'cbad', 'cbda', 'acdb', 'cadb', 'cdab', 'cdba', 'abdc', 'badc', 'bdac', 'bdca', 'adbc', 'dabc', 'dbac', 'dbca', 'adcb', 'dacb', 'dcab', 'dcba']"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to round the given number to the nearest multiple of a specific number.
Your code should pass the test:
assert round_num(4722,10)==4720
|
[
"assert round_num(4722,10)==4720",
"assert round_num(1111,5)==1110",
"assert round_num(219,2)==218"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to remove tuple elements that occur more than once and replace the duplicates with some custom value.
Your code should pass the test:
assert remove_replica((1, 1, 4, 4, 4, 5, 5, 6, 7, 7)) == (1, 'MSP', 4, 'MSP', 'MSP', 5, 'MSP', 6, 7, 'MSP')
|
[
"assert remove_replica((1, 1, 4, 4, 4, 5, 5, 6, 7, 7)) == (1, 'MSP', 4, 'MSP', 'MSP', 5, 'MSP', 6, 7, 'MSP')",
"assert remove_replica((2, 3, 4, 4, 5, 6, 6, 7, 8, 9, 9)) == (2, 3, 4, 'MSP', 5, 6, 'MSP', 7, 8, 9, 'MSP')",
"assert remove_replica((2, 2, 5, 4, 5, 7, 5, 6, 7, 7)) == (2, 'MSP', 5, 4, 'MSP', 7, 'MSP', 6, 'MSP', 'MSP')"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a python function to remove all occurrences of a character in a given string.
Your code should pass the test:
assert remove_Char("aba",'a') == "b"
|
[
"assert remove_Char(\"aba\",'a') == \"b\"",
"assert remove_Char(\"toggle\",'g') == \"tole\"",
"assert remove_Char(\"aabbc\",'b') == \"aac\""
] | 1
|
function
|
Here is the completed code:
```python
|
Write a python function to shift last element to first position in the given list.
Your code should pass the test:
assert move_first([1,2,3,4]) == [4,1,2,3]
|
[
"assert move_first([1,2,3,4]) == [4,1,2,3]",
"assert move_first([0,1,2,3]) == [3,0,1,2]",
"assert move_first([9,8,7,1]) == [1,9,8,7]"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to find the surface area of a cuboid.
Your code should pass the test:
assert surfacearea_cuboid(1,2,3)==22
|
[
"assert surfacearea_cuboid(1,2,3)==22",
"assert surfacearea_cuboid(5,7,9)==286",
"assert surfacearea_cuboid(10,15,21)==1350"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to generate a two-dimensional array.
Your code should pass the test:
assert multi_list(3,4)==[[0, 0, 0, 0], [0, 1, 2, 3], [0, 2, 4, 6]]
|
[
"assert multi_list(3,4)==[[0, 0, 0, 0], [0, 1, 2, 3], [0, 2, 4, 6]] ",
"assert multi_list(5,7)==[[0, 0, 0, 0, 0, 0, 0], [0, 1, 2, 3, 4, 5, 6], [0, 2, 4, 6, 8, 10, 12], [0, 3, 6, 9, 12, 15, 18], [0, 4, 8, 12, 16, 20, 24]]",
"assert multi_list(10,15)==[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28], [0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42], [0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56], [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70], [0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72, 78, 84], [0, 7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84, 91, 98], [0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112], [0, 9, 18, 27, 36, 45, 54, 63, 72, 81, 90, 99, 108, 117, 126]]"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to sort a list of lists by a given index of the inner list.
Your code should pass the test:
assert index_on_inner_list([('Greyson Fulton', 98, 99), ('Brady Kent', 97, 96), ('Wyatt Knott', 91, 94), ('Beau Turnbull', 94, 98)] ,0)==[('Beau Turnbull', 94, 98), ('Brady Kent', 97, 96), ('Greyson Fulton', 98, 99), ('Wyatt Knott', 91, 94)]
|
[
"assert index_on_inner_list([('Greyson Fulton', 98, 99), ('Brady Kent', 97, 96), ('Wyatt Knott', 91, 94), ('Beau Turnbull', 94, 98)] ,0)==[('Beau Turnbull', 94, 98), ('Brady Kent', 97, 96), ('Greyson Fulton', 98, 99), ('Wyatt Knott', 91, 94)]",
"assert index_on_inner_list([('Greyson Fulton', 98, 99), ('Brady Kent', 97, 96), ('Wyatt Knott', 91, 94), ('Beau Turnbull', 94, 98)] ,1)==[('Wyatt Knott', 91, 94), ('Beau Turnbull', 94, 98), ('Brady Kent', 97, 96), ('Greyson Fulton', 98, 99)]",
"assert index_on_inner_list([('Greyson Fulton', 98, 99), ('Brady Kent', 97, 96), ('Wyatt Knott', 91, 94), ('Beau Turnbull', 94, 98)] ,2)==[('Wyatt Knott', 91, 94), ('Brady Kent', 97, 96), ('Beau Turnbull', 94, 98), ('Greyson Fulton', 98, 99)]"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to find the number of rotations in a circularly sorted array.
Your code should pass the test:
assert find_rotation_count([8, 9, 10, 1, 2, 3, 4, 5, 6, 7]) == 3
|
[
"assert find_rotation_count([8, 9, 10, 1, 2, 3, 4, 5, 6, 7]) == 3",
"assert find_rotation_count([8, 9, 10,2, 5, 6]) == 3",
"assert find_rotation_count([2, 5, 6, 8, 9, 10]) == 0"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a python function to toggle all odd bits of a given number.
Your code should pass the test:
assert even_bit_toggle_number(10) == 15
|
[
"assert even_bit_toggle_number(10) == 15",
"assert even_bit_toggle_number(20) == 1",
"assert even_bit_toggle_number(30) == 11"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a python function to find the frequency of the smallest value in a given array.
Your code should pass the test:
assert frequency_Of_Smallest(5,[1,2,3,4,3]) == 1
|
[
"assert frequency_Of_Smallest(5,[1,2,3,4,3]) == 1",
"assert frequency_Of_Smallest(7,[3,1,2,5,6,2,3]) == 1",
"assert frequency_Of_Smallest(7,[3,3,6,3,7,4,9]) == 3"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to find the n'th perrin number using recursion.
Your code should pass the test:
assert get_perrin(9) == 12
|
[
"assert get_perrin(9) == 12",
"assert get_perrin(4) == 2",
"assert get_perrin(6) == 5"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to find out the minimum no of swaps required for bracket balancing in the given string.
Your code should pass the test:
assert swap_count("[]][][") == 2
|
[
"assert swap_count(\"[]][][\") == 2",
"assert swap_count(\"[[][]]\") == 0",
"assert swap_count(\"[[][]]][\") == 1"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a python function to check whether the hexadecimal number is even or odd.
Your code should pass the test:
assert even_or_odd("AB3454D") =="Odd"
|
[
"assert even_or_odd(\"AB3454D\") ==\"Odd\"",
"assert even_or_odd(\"ABC\") == \"Even\"",
"assert even_or_odd(\"AAD\") == \"Odd\""
] | 1
|
function
|
Here is the completed code:
```python
|
Write a python function to find the highest power of 2 that is less than or equal to n.
Your code should pass the test:
assert highest_Power_of_2(10) == 8
|
[
"assert highest_Power_of_2(10) == 8",
"assert highest_Power_of_2(19) == 16",
"assert highest_Power_of_2(32) == 32"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to find the n'th lucas number.
Your code should pass the test:
assert find_lucas(9) == 76
|
[
"assert find_lucas(9) == 76",
"assert find_lucas(4) == 7",
"assert find_lucas(3) == 4"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to insert a given string at the beginning of all items in a list.
Your code should pass the test:
assert add_string([1,2,3,4],'temp{0}')==['temp1', 'temp2', 'temp3', 'temp4']
|
[
"assert add_string([1,2,3,4],'temp{0}')==['temp1', 'temp2', 'temp3', 'temp4']",
"assert add_string(['a','b','c','d'], 'python{0}')==[ 'pythona', 'pythonb', 'pythonc', 'pythond']",
"assert add_string([5,6,7,8],'string{0}')==['string5', 'string6', 'string7', 'string8']"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to convert more than one list to nested dictionary.
Your code should pass the test:
assert convert_list_dictionary(["S001", "S002", "S003", "S004"],["Adina Park", "Leyton Marsh", "Duncan Boyle", "Saim Richards"] ,[85, 98, 89, 92])==[{'S001': {'Adina Park': 85}}, {'S002': {'Leyton Marsh': 98}}, {'S003': {'Duncan Boyle': 89}}, {'S004': {'Saim Richards': 92}}]
|
[
"assert convert_list_dictionary([\"S001\", \"S002\", \"S003\", \"S004\"],[\"Adina Park\", \"Leyton Marsh\", \"Duncan Boyle\", \"Saim Richards\"] ,[85, 98, 89, 92])==[{'S001': {'Adina Park': 85}}, {'S002': {'Leyton Marsh': 98}}, {'S003': {'Duncan Boyle': 89}}, {'S004': {'Saim Richards': 92}}]",
"assert convert_list_dictionary([\"abc\",\"def\",\"ghi\",\"jkl\"],[\"python\",\"program\",\"language\",\"programs\"],[100,200,300,400])==[{'abc':{'python':100}},{'def':{'program':200}},{'ghi':{'language':300}},{'jkl':{'programs':400}}]",
"assert convert_list_dictionary([\"A1\",\"A2\",\"A3\",\"A4\"],[\"java\",\"C\",\"C++\",\"DBMS\"],[10,20,30,40])==[{'A1':{'java':10}},{'A2':{'C':20}},{'A3':{'C++':30}},{'A4':{'DBMS':40}}]"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to find the maximum sum possible by using the given equation f(n) = max( (f(n/2) + f(n/3) + f(n/4) + f(n/5)), n).
Your code should pass the test:
assert get_max_sum(60) == 106
|
[
"assert get_max_sum(60) == 106",
"assert get_max_sum(10) == 12",
"assert get_max_sum(2) == 2"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to find the list with maximum length using lambda function.
Your code should pass the test:
assert max_length_list([[0], [1, 3], [5, 7], [9, 11], [13, 15, 17]])==(3, [13, 15, 17])
|
[
"assert max_length_list([[0], [1, 3], [5, 7], [9, 11], [13, 15, 17]])==(3, [13, 15, 17])",
"assert max_length_list([[1,2,3,4,5],[1,2,3,4],[1,2,3],[1,2],[1]])==(5,[1,2,3,4,5])",
"assert max_length_list([[3,4,5],[6,7,8,9],[10,11,12]])==(4,[6,7,8,9])"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to check if given tuple is distinct or not.
Your code should pass the test:
assert check_distinct((1, 4, 5, 6, 1, 4)) == False
|
[
"assert check_distinct((1, 4, 5, 6, 1, 4)) == False",
"assert check_distinct((1, 4, 5, 6)) == True",
"assert check_distinct((2, 3, 4, 5, 6)) == True"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a python function to find the first non-repeated character in a given string.
Your code should pass the test:
assert first_non_repeating_character("abcabc") == None
|
[
"assert first_non_repeating_character(\"abcabc\") == None",
"assert first_non_repeating_character(\"abc\") == \"a\"",
"assert first_non_repeating_character(\"ababc\") == \"c\""
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to check whether the given string starts and ends with the same character or not using regex.
Your code should pass the test:
assert check_char("abba") == "Valid"
|
[
"assert check_char(\"abba\") == \"Valid\"",
"assert check_char(\"a\") == \"Valid\"",
"assert check_char(\"abcd\") == \"Invalid\""
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to find the median of three specific numbers.
Your code should pass the test:
assert median_numbers(25,55,65)==55.0
|
[
"assert median_numbers(25,55,65)==55.0",
"assert median_numbers(20,10,30)==20.0",
"assert median_numbers(15,45,75)==45.0"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to compute the sum of digits of each number of a given list.
Your code should pass the test:
assert sum_of_digits([10,2,56])==14
|
[
"assert sum_of_digits([10,2,56])==14",
"assert sum_of_digits([[10,20,4,5,'b',70,'a']])==19",
"assert sum_of_digits([10,20,-4,5,-70])==19"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to perform the mathematical bitwise xor operation across the given tuples.
Your code should pass the test:
assert bitwise_xor((10, 4, 6, 9), (5, 2, 3, 3)) == (15, 6, 5, 10)
|
[
"assert bitwise_xor((10, 4, 6, 9), (5, 2, 3, 3)) == (15, 6, 5, 10)",
"assert bitwise_xor((11, 5, 7, 10), (6, 3, 4, 4)) == (13, 6, 3, 14)",
"assert bitwise_xor((12, 6, 8, 11), (7, 4, 5, 6)) == (11, 2, 13, 13)"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to extract the frequency of unique tuples in the given list order irrespective.
Your code should pass the test:
assert extract_freq([(3, 4), (1, 2), (4, 3), (5, 6)] ) == 3
|
[
"assert extract_freq([(3, 4), (1, 2), (4, 3), (5, 6)] ) == 3",
"assert extract_freq([(4, 15), (2, 3), (5, 4), (6, 7)] ) == 4",
"assert extract_freq([(5, 16), (2, 3), (6, 5), (6, 9)] ) == 4"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to perform index wise addition of tuple elements in the given two nested tuples.
Your code should pass the test:
assert add_nested_tuples(((1, 3), (4, 5), (2, 9), (1, 10)), ((6, 7), (3, 9), (1, 1), (7, 3))) == ((7, 10), (7, 14), (3, 10), (8, 13))
|
[
"assert add_nested_tuples(((1, 3), (4, 5), (2, 9), (1, 10)), ((6, 7), (3, 9), (1, 1), (7, 3))) == ((7, 10), (7, 14), (3, 10), (8, 13))",
"assert add_nested_tuples(((2, 4), (5, 6), (3, 10), (2, 11)), ((7, 8), (4, 10), (2, 2), (8, 4))) == ((9, 12), (9, 16), (5, 12), (10, 15))",
"assert add_nested_tuples(((3, 5), (6, 7), (4, 11), (3, 12)), ((8, 9), (5, 11), (3, 3), (9, 5))) == ((11, 14), (11, 18), (7, 14), (12, 17))"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to compute the value of ncr%p.
Your code should pass the test:
assert ncr_modp(10,2,13)==6
|
[
"assert ncr_modp(10,2,13)==6",
"assert ncr_modp(15,12,43)==25",
"assert ncr_modp(17,9,18)==10"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to check if a url is valid or not using regex.
Your code should pass the test:
assert is_valid_URL("https://www.google.com") == True
|
[
"assert is_valid_URL(\"https://www.google.com\") == True",
"assert is_valid_URL(\"https:/www.gmail.com\") == False",
"assert is_valid_URL(\"https:// www.redit.com\") == False"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a python function to find the minimum of two numbers.
Your code should pass the test:
assert minimum(1,2) == 1
|
[
"assert minimum(1,2) == 1",
"assert minimum(-5,-4) == -5",
"assert minimum(0,0) == 0"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to check whether an element exists within a tuple.
Your code should pass the test:
assert check_tuplex(("w", 3, "r", "e", "s", "o", "u", "r", "c", "e"),'r')==True
|
[
"assert check_tuplex((\"w\", 3, \"r\", \"e\", \"s\", \"o\", \"u\", \"r\", \"c\", \"e\"),'r')==True",
"assert check_tuplex((\"w\", 3, \"r\", \"e\", \"s\", \"o\", \"u\", \"r\", \"c\", \"e\"),'5')==False",
"assert check_tuplex((\"w\", 3, \"r\", \"e\", \"s\", \"o\", \"u\", \"r\", \"c\",\"e\"),3)==True"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a python function to find the parity of a given number.
Your code should pass the test:
assert find_Parity(12) == "Even Parity"
|
[
"assert find_Parity(12) == \"Even Parity\"",
"assert find_Parity(7) == \"Odd Parity\"",
"assert find_Parity(10) == \"Even Parity\""
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to create the next bigger number by rearranging the digits of a given number.
Your code should pass the test:
assert rearrange_bigger(12)==21
|
[
"assert rearrange_bigger(12)==21",
"assert rearrange_bigger(10)==False",
"assert rearrange_bigger(102)==120"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to find k number of pairs which consist of one element from the first array and one element from the second array.
Your code should pass the test:
assert k_smallest_pairs([1,3,7],[2,4,6],2)==[[1, 2], [1, 4]]
|
[
"assert k_smallest_pairs([1,3,7],[2,4,6],2)==[[1, 2], [1, 4]]",
"assert k_smallest_pairs([1,3,7],[2,4,6],1)==[[1, 2]]",
"assert k_smallest_pairs([1,3,7],[2,4,6],7)==[[1, 2], [1, 4], [3, 2], [1, 6], [3, 4], [3, 6], [7, 2]]"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to find the minimum product from the pairs of tuples within a given list.
Your code should pass the test:
assert min_product_tuple([(2, 7), (2, 6), (1, 8), (4, 9)] )==8
|
[
"assert min_product_tuple([(2, 7), (2, 6), (1, 8), (4, 9)] )==8",
"assert min_product_tuple([(10,20), (15,2), (5,10)] )==30",
"assert min_product_tuple([(11,44), (10,15), (20,5), (12, 9)] )==100"
] | 1
|
function
|
Here is the completed code:
```python
|
Write a function to find the minimum value in a given heterogeneous list.
Your code should pass the test:
assert min_val(['Python', 3, 2, 4, 5, 'version'])==2
|
[
"assert min_val(['Python', 3, 2, 4, 5, 'version'])==2",
"assert min_val(['Python', 15, 20, 25])==15",
"assert min_val(['Python', 30, 20, 40, 50, 'version'])==20"
] | 1
|
function
|
Here is the completed code:
```python
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.