task_id
stringlengths
16
18
prompt
stringlengths
138
1.57k
entry_point
stringlengths
3
62
entry_point_auxiliary
stringlengths
1
30
test
stringlengths
607
3.55k
HumanExtension/100
from typing import List def exchange_from_repetition(lst1: List[int], lst2: List[int], n: int) -> List[str]: """In this problem, you will implement a function that takes two lists of numbers (lst1 and lst2) and a number (n), and determines whether it is possible to perform an exchange of elements between ...
exchange_from_repetition
exchange
from typing import List def exchange(lst1: List[int], lst2: List[int]) -> str: """In this problem, you will implement a function that takes two lists of numbers, and determines whether it is possible to perform an exchange of elements between them to make lst1 a list of only even numbers. There is no ...
HumanExtension/101
from typing import Dict, Tuple def most_frequent_letter(test: str) -> Tuple[str, int]: """Given a string representing a space separated lowercase letters, return a tuple of the letter with the most repetition and containing the corresponding count. If several letters have the same occurrence, return the l...
most_frequent_letter
histogram
from typing import Dict, Tuple def histogram(test: str) -> Dict[str, int]: """Given a string representing a space separated lowercase letters, return a dictionary of the letter with the most repetition and containing the corresponding count. If several letters have the same occurrence, return all of them....
HumanExtension/102
from typing import List, Tuple def reverse_delete_list(s: str, c: str) -> List[Tuple[str, bool]]: """Task We are given two strings s and c, you have to deleted all the characters in s that are equal to each of the characters in c then check if each result string is palindrome. A string is called palin...
reverse_delete_list
reverse_delete
from typing import List, Tuple def reverse_delete(s: str, c: str) -> Tuple[str, bool]: """Task We are given two strings s and c, you have to deleted all the characters in s that are equal to any character in c then check if the result string is palindrome. A string is called palindrome if it reads the...
HumanExtension/103
from typing import List def split_odd_count(lst: List[str], strsize: int) -> List[str]: """Given a list of strings, where each string consists of only digits, first split each string into shorter ones with the length strsize and return a list. Each element i of the output should be "the number of odd elem...
split_odd_count
odd_count
from typing import List def odd_count(lst: List[str]) -> List[str]: """Given a list of strings, where each string consists of only digits, return a list. Each element i of the output should be "the number of odd elements in the string i of the input." where all the i's should be replaced by the number ...
HumanExtension/104
from typing import List def minSubArraySumNonNegative(nums: List[int]) -> int: """Given an array of integers nums, find the minimum sum of any non-empty sub-array of nums. Consider all negative integers as 0. Example >>> minSubArraySumNonNegative([2, 3, 4, 1, 2, 4]) 1 >>> minSubArraySumNonNega...
minSubArraySumNonNegative
minSubArraySum
from typing import List def minSubArraySum(nums: List[int]) -> int: """ Given an array of integers nums, find the minimum sum of any non-empty sub-array of nums. Example >>> minSubArraySum([2, 3, 4, 1, 2, 4]) 1 >>> minSubArraySum([-1, -2, -3]) -6 """ max_sum = 0 s = 0 f...
HumanExtension/105
import math from typing import List def max_fill_buckets(grid: List[List[int]], capacities: List[int]) -> List[int]: """You are given a rectangular grid of wells. Each row represents a single well, and each 1 in a row represents a single unit of water. Each well has corresponding buckets that can be used ...
max_fill_buckets
max_fill
import math from typing import List def max_fill(grid: List[List[int]], capacity: int) -> int: """ You are given a rectangular grid of wells. Each row represents a single well, and each 1 in a row represents a single unit of water. Each well has a corresponding bucket that can be used to extract water...
HumanExtension/106
from typing import List def check_moving_sort_array(arr: List[int]) -> List[bool]: """In this Kata, you have to sort an array of non-negative integers according to number of ones in their binary representation in ascending order. For similar number of ones, sort based on decimal value. Compare the ori...
check_moving_sort_array
sort_array
from typing import List def sort_array(arr: List[int]) -> List[int]: """ In this Kata, you have to sort an array of non-negative integers according to number of ones in their binary representation in ascending order. For similar number of ones, sort based on decimal value. It must be implemented ...
HumanExtension/107
from typing import List def select_largest_word(s: str, n: int) -> str: """Given a string s and a natural number n, you have been tasked to implement a function that returns the word from string s that contain exactly n consonants. If there exist multiple words satisfying the condition, return the largest...
select_largest_word
select_words
from typing import List def select_words(s: str, n: int) -> List[str]: """Given a string s and a natural number n, you have been tasked to implement a function that returns a list of all words from string s that contain exactly n consonants, in order these words appear in the string s. If the string s...
HumanExtension/108
def transform_closest_vowel(s: str) -> str: """You are given a string containing multiple words. Your task is to make a new string by changing each word to its closest vowel that stands between two consonants from the right side of the word (case sensitive). You need to concatenate all the closest vowels th...
transform_closest_vowel
get_closest_vowel
def get_closest_vowel(word: str) -> str: """You are given a word. Your task is to find the closest vowel that stands between two consonants from the right side of the word (case sensitive). Vowels in the beginning and ending doesn't count. Return empty string if you didn't find any vowel met the above ...
HumanExtension/109
from typing import List def match_parens_from_list(str1: str, lst2: List[str]) -> str: """You are given a string (str1) and a list of strings (lst2), where every string consists of open parentheses '(' or close parentheses ')' only. Your job is to check if it is possible to concatenate a string (selected ...
match_parens_from_list
match_parens
from typing import List def match_parens(lst: List[str]) -> str: """ You are given a list of two strings, both strings consist of open parentheses '(' or close parentheses ')' only. Your job is to check if it is possible to concatenate the two strings in some order, that the resulting string will ...
HumanExtension/110
from typing import List def minimum_of_maximum_subarrays(arrays: List[List[int]], k: int) -> int: """Given a list of arrays and a positive integer k, return the minimal integer among the arrays. Example 1: >>> minimum_of_maximum_subarrays([[-3, -4, 5], [4, -4, 4], [-3, 2, 1, 2, -1, -2, 1]], 2) ...
minimum_of_maximum_subarrays
maximum
from typing import List def maximum(arr: List[int], k: int) -> List[int]: """ Given an array arr of integers and a positive integer k, return a sorted list of length k with the maximum k numbers in arr. Example 1: >>> maximum([-3, -4, 5], 3) [-4, -3, 5] Example 2: >>> maximum([4, -...
HumanExtension/111
from typing import List def alternate_sum(arrays: List[List[int]]) -> int: """Given a list of arrays, return the sum of all of the odd elements that are in even positions of all arrays in even positions minus the sum of all of the odd elements that are in odd positions. Examples >>> alternat...
alternate_sum
solution
from typing import List def solution(lst: List[int]) -> int: """Given a non-empty list of integers, return the sum of all of the odd elements that are in even positions. Examples >>> solution([5, 8, 7, 1]) 12 >>> solution([3, 3, 3, 3, 3]) 9 >>> solution([30, 13, 24, 321]) 0 """ ...
HumanExtension/112
from typing import List def max_num_passengers(arr: List[int]) -> int: """Given an array of integers arr where each element represents the weight of passengers, return the maximum number of passengers that can be carried on a single elevator given that the sum of all the weights must be less than 100. ...
max_num_passengers
add_elements
from typing import List def add_elements(arr: List[int], k: int) -> int: """ Given a non-empty array of integers arr and an integer k, return the sum of the elements with at most two digits from the first k elements of arr. Example: >>> add_elements([111, 21, 3, 4000, 5, 6, 7, 8, 9], 4) 24 ...
HumanExtension/113
from typing import List def sum_odd_collatz(n: int) -> int: """Given a positive integer n, return the sum of odd numbers in collatz sequence. Examples: >>> sum_odd_collatz(5) 6 >>> sum_odd_collatz(10) 6"""
sum_odd_collatz
get_odd_collatz
from typing import List def get_odd_collatz(n: int) -> List[int]: """ Given a positive integer n, return a sorted list that has the odd numbers in collatz sequence. The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined as follows: start with any positive integer n. Th...
HumanExtension/114
from typing import List def num_valid_birthdays(dates: List[str]) -> int: """Given a list of birthdays with valid dates, return the number of people who can be given some birthday gifts. >>> num_valid_birthdays(['03-11-2000', '15-01-2012', '04-0-2040', '06-04-2020']) 2"""
num_valid_birthdays
valid_date
from typing import List def valid_date(date: str) -> bool: """You have to write a function which validates a given date string and returns True if the date is valid otherwise False. The date is valid if all of the following rules are satisfied: 1. The date string is not empty. 2. The number of day...
HumanExtension/115
from typing import List, Union def num_words(txt: str) -> int: """Given one sentence of words, return the number of words in it. >>> num_words('Hello world!') 2 >>> num_words('Hello,world!') 2 >>> num_words('abcdef') 1"""
num_words
split_words
from typing import List, Union def split_words(txt: str) -> Union[List[str], int]: """ Given a string of words, return a list of words split on whitespace, if no whitespaces exists in the text you should split on commas ',' if no commas exists you should return the number of lower-case letters with odd or...
HumanExtension/116
from typing import List def all_sorted(lst: List[List[int]]) -> bool: """Given a non-empty list of lists of integers, return a boolean values indicating whether each sublist is sorted in ascending order without more than one duplicate of the same number. Examples >>> all_sorted([[5], [1, 2, 3, 4,...
all_sorted
is_sorted
from typing import List def is_sorted(lst: List[int]) -> bool: """ Given a list of numbers, return whether or not they are sorted in ascending order. If list has more than 1 duplicate of the same number, return False. Assume no negative numbers and only integers. Examples >>> is_sorted([5]) ...
HumanExtension/117
from itertools import combinations from typing import List, Tuple def all_prime_intersection(intervals: List[Tuple[int, int]]) -> bool: """Check if all intersections of given intervals are prime numbers. [inpt/output] samples: >>> all_prime_intersection([(1, 2), (2, 3), (3, 4)]) False >>> all...
all_prime_intersection
intersection
from itertools import combinations from typing import List, Tuple def intersection(interval1: Tuple[int, int], interval2: Tuple[int, int]) -> str: """You are given two intervals, where each interval is a pair of integers. For example, interval = (start, end) = (1, 2). The given intervals are closed which ...
HumanExtension/118
from typing import List, Optional def prod_signs_within_threshold(arr: List[int], threshold: int) -> Optional[int]: """You are given an array arr of integers and you need to return sum of magnitudes of integers within the threshold value, multiplied by product of all signs of each number in the array. ...
prod_signs_within_threshold
prod_signs
from typing import List, Optional def prod_signs(arr: List[int]) -> Optional[int]: """ You are given an array arr of integers and you need to return sum of magnitudes of integers multiplied by product of all signs of each number in the array, represented by 1, -1 or 0. Note: return None for empty ...
HumanExtension/119
def beautiful_tri(start: int, end: int) -> list[int]: """Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in the last couple centuries. However, what people don't know is Tribonacci sequence. Tribonacci sequence is defined by the recurrence: tri(1) = 3 tri(n) = 1 + n / 2, i...
beautiful_tri
tri
def tri(n: int) -> list[int]: """Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in the last couple centuries. However, what people don't know is Tribonacci sequence. Tribonacci sequence is defined by the recurrence: tri(1) = 3 tri(n) = 1 + n / 2, if n is even. tri(n) ...
HumanExtension/120
from typing import List def unique_odd_digits(lst: List[int]) -> int: """Given a list of positive integers, return the product of unique odd digits. For example: >>> unique_odd_digits([1, 4, 235]) 15 >>> unique_odd_digits([123, 456, 789]) 945 >>> unique_odd_digits([2, 4, 6, 8, 99]) 9""...
unique_odd_digits
digits
from typing import List def digits(n: int) -> int: """Given a positive integer n, return the product of the odd digits. Return 0 if all digits are even. For example: >>> digits(1) 1 >>> digits(4) 0 >>> digits(235) 15 """ product = 1 odd_count = 0 for digit in str(n)...
HumanExtension/121
from typing import List def diff_ceil_floor_sum_squares(lst: List[float]) -> int: """You are given a list of numbers. You need to return the absolute difference between the sum of squared numbers in the given list, round each element in the list to the upper int(Ceiling) first, and the sum of squared ...
diff_ceil_floor_sum_squares
sum_squares
from typing import List def sum_squares(lst: List[float]) -> int: """You are given a list of numbers. You need to return the sum of squared numbers in the given list, round each element in the list to the upper int(Ceiling) first. Examples: >>> lst([1.0, 2.0, 3.0]) 14 >>> lst([1.0, 4.0, 9....
HumanExtension/122
def check_if_first_char_is_a_letter(txt: str) -> bool: """Create a function that returns True if the first character of a given string is an alphabetical character and is not a part of a word, and False otherwise. Note: "word" is a group of characters separated by space. Examples: >>> check...
check_if_first_char_is_a_letter
check_if_last_char_is_a_letter
def check_if_last_char_is_a_letter(txt: str) -> bool: """ Create a function that returns True if the last character of a given string is an alphabetical character and is not a part of a word, and False otherwise. Note: "word" is a group of characters separated by space. Examples: >>> check_...
HumanExtension/123
from typing import List def is_ordered(arr: List[int]) -> bool: """Create a function which returns True if the given array is sorted in either ascending or descending order, otherwise return False. Examples: >>> is_ordered([1, 2, 4, 3, 5]) False >>> is_ordered([1, 2, 3]) True >>> ...
is_ordered
can_arrange
from typing import List def can_arrange(arr: List[int]) -> int: """Create a function which returns the largest index of an element which is not greater than or equal to the element immediately preceding it. If no such element exists then return -1. The given array will not contain duplicate values. ...
HumanExtension/124
from typing import List, Optional, Tuple def smallest_interval_including_zero(lst: List[int]) -> int: """Create a function that returns the length of the smallest interval that includes zero. If there is no such interval, return 0. Examples: >>> smallest_interval_including_zero([2, 4, 1, 3, 5, 7]...
smallest_interval_including_zero
largest_smallest_integers
from typing import List, Optional, Tuple def largest_smallest_integers(lst: List[int]) -> Tuple[Optional[int], Optional[int]]: """ Create a function that returns a tuple (a, b), where 'a' is the largest of negative integers, and 'b' is the smallest of positive integers in a list. If there is no ne...
HumanExtension/125
from itertools import combinations from typing import List, Union def biggest(lst: List[Union[int, float, str]]) -> Union[int, float, str, None]: """Create a function that takes a list of integers, floats, or strings representing real numbers, and returns the non-duplicate largest variable in its given variab...
biggest
compare_one
from itertools import combinations from typing import List, Union def compare_one(a: Union[int, float, str], b: Union[int, float, str]) -> Union[int, float, str, None]: """ Create a function that takes integers, floats, or strings representing real numbers, and returns the larger variable in its given var...
HumanExtension/126
from typing import List def num_test_subjects(lst: List[int]) -> int: """In your country, people are obligated to take a inspection test every 2 years after they turn 8. You are given a list of ages of people in your country. Return the number of people who are required to take the test in the next ye...
num_test_subjects
is_equal_to_sum_even
from typing import List def is_equal_to_sum_even(n: int) -> bool: """Evaluate whether the given number n can be written as the sum of exactly 4 positive even numbers Example >>> is_equal_to_sum_even(4) False >>> is_equal_to_sum_even(6) False >>> is_equal_to_sum_even(8) True """ ...
HumanExtension/127
def factorial(n: int) -> int: """The factorial of a positive integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example: >>> factorial(4) 24 >>> factorial(1) 1 >>> factorial(5) 120 The function will receive an integer as ...
factorial
special_factorial
def special_factorial(n: int) -> int: """The Brazilian factorial is defined as: brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1! where n > 0 For example: >>> special_factorial(4) 288 The function will receive an integer as input and should return the special factorial of this i...
HumanExtension/128
def extended_fix_spaces(text: str) -> str: """Given a string text, replace all spaces and tab in it with underscores. Consider a tab as 4 spaces, and if a string has more than 2 consecutive spaces, then replace all consecutive spaces with - >>> extended_fix_spaces('Example') 'Example' >>> e...
extended_fix_spaces
fix_spaces
def fix_spaces(text: str) -> str: """ Given a string text, replace all spaces in it with underscores, and if a string has more than 2 consecutive spaces, then replace all consecutive spaces with - >>> fix_spaces('Example') 'Example' >>> fix_spaces('Example 1') 'Example_1' >>> fix_sp...
HumanExtension/129
def download_link_check(link: str) -> str: """Create a function which takes a string representing a link address, and returns 'Yes' if the the link is valid, and returns 'No' otherwise. A link name is considered to be valid if and only if all the following conditions are met: - There should not be m...
download_link_check
file_name_check
def file_name_check(file_name: str) -> str: """Create a function which takes a string representing a file's name, and returns 'Yes' if the the file's name is valid, and returns 'No' otherwise. A file's name is considered to be valid if and only if all the following conditions are met: - There should...
HumanExtension/130
def extended_sum_squares(lst: list[int]) -> int: """This function will take a list of integers. For all entries in the list, the function shall square the integer entry if its index is a multiple of 3 and will cube the integer entry if its index is a multiple of 4 and not a multiple of 3 and negate the ...
extended_sum_squares
sum_squares
def sum_squares(lst: list[int]) -> int: """ " This function will take a list of integers. For all entries in the list, the function shall square the integer entry if its index is a multiple of 3 and will cube the integer entry if its index is a multiple of 4 and not a multiple of 3. The function will not ...
HumanExtension/131
def extended_words_in_sentence(sentence: str, sep: str) -> str: """You are given a string representing a sentence, the sentence contains some words separated by `sep`, and you have to return a string that contains the words from the original sentence, whose lengths are prime numbers, the order of th...
extended_words_in_sentence
words_in_sentence
def words_in_sentence(sentence: str) -> str: """ You are given a string representing a sentence, the sentence contains some words separated by a space, and you have to return a string that contains the words from the original sentence, whose lengths are prime numbers, the order of the words in t...
HumanExtension/132
from typing import Optional def get_simplified_pair(l: list[str]) -> Optional[tuple[str, str]]: """Find a pair (a, b) which can be simplified in the given list of fractions. Simplified means that a * b is a whole number. Both a and b are string representation of a fraction, and have the following format, ...
get_simplified_pair
simplify
from typing import Optional def simplify(x: str, n: str) -> bool: """Your task is to implement a function that will simplify the expression x * n. The function returns True if x * n evaluates to a whole number and False otherwise. Both x and n, are string representation of a fraction, and have the followi...
HumanExtension/133
def positive_order_by_points(nums: list[int]) -> list[int]: """Write a function which sorts the integers in the given list that is greater than zero. Note: if there are several items with similar sum of their digits, order them based on their index in original list. For example: >>> positiv...
positive_order_by_points
order_by_points
def order_by_points(nums: list[int]) -> list[int]: """ Write a function which sorts the given list of integers in ascending order according to the sum of their digits. Note: if there are several items with similar sum of their digits, order them based on their index in original list. For exampl...
HumanExtension/134
def extended_special_filter(nums: list[int]) -> int: """Write a function that takes an array of numbers as input and returns the number of elements in the array that are greater than 10 and both first digits of a number are odd (1, 3, 5, 7, 9) and last digits of a number is even. For example: >>> sp...
extended_special_filter
specialFilter
def specialFilter(nums: list[int]) -> int: """Write a function that takes an array of numbers as input and returns the number of elements in the array that are greater than 10 and both first and last digits of a number are odd (1, 3, 5, 7, 9). For example: >>> specialFilter([15, -73, 14, -15]) 1...
HumanExtension/135
def get_not_max_triple(n: int) -> int: """You are given a positive integer n. You have to create an integer array a of length n. For each i (1 ≤ i ≤ n), the value of a[i] = i * i - i + 1. Return the number of triples (a[i], a[j], a[k]) of a where i < j < k, and a[i] + a[j] + a[k] is not a multip...
get_not_max_triple
get_max_triples
def get_max_triples(n: int) -> int: """ You are given a positive integer n. You have to create an integer array a of length n. For each i (1 ≤ i ≤ n), the value of a[i] = i * i - i + 1. Return the number of triples (a[i], a[j], a[k]) of a where i < j < k, and a[i] + a[j] + a[k] is a multiple...
HumanExtension/136
from typing import Tuple def living_area(planet1: str, planet2: str) -> bool: """There are eight planets in our solar system: the closerst to the Sun is Mercury, the next one is Venus, then Earth, Mars, Jupiter, Saturn, Uranus, Neptune. Among this planets, Earth is the only planet that can live human....
living_area
bf
from typing import Tuple def bf(planet1: str, planet2: str) -> Tuple[str, ...]: """ There are eight planets in our solar system: the closerst to the Sun is Mercury, the next one is Venus, then Earth, Mars, Jupiter, Saturn, Uranus, Neptune. Write a function that takes two planet names as strings pl...
HumanExtension/137
from typing import List def extract_even_words(text: str) -> str: """Write a function that accepts a string as a parameter, and a string is consisted of words separated by spaces, deletes the words that have odd lengths from it, and returns the resulted string with a sorted order, The order of the wor...
extract_even_words
sorted_list_sum
from typing import List def sorted_list_sum(lst: List[str]) -> List[str]: """Write a function that accepts a list of strings as a parameter, deletes the strings that have odd lengths from it, and returns the resulted list with a sorted order, The list is always a list of strings and never an array of ...
HumanExtension/138
def list_x_or_y(ns: list[int], xs: list[int], ys: list[int]) -> list[int]: """A simple program which should return a list of values of x if the corresponding value in ns is a prime number and should return the value of y otherwise. Examples: >>> list_x_or_by([7, 15, 21], [34, 8, 3], [12, 5, 7])...
list_x_or_y
x_or_y
def x_or_y(n: int, x: int, y: int) -> int: """A simple program which should return the value of x if n is a prime number and should return the value of y otherwise. Examples: >>> x_or_y(7, 34, 12) 34 >>> x_or_y(15, 8, 5) 5 """ if n == 1: return y for i in range(2, n): ...
HumanExtension/139
def extended_double_the_difference(lst: list[float]) -> int: """Given a list of numbers, return the sum of squares of the numbers in the list that are odd and the cubic of the number in the list that are even. Ignore numbers that are negative or not integers. >>> double_the_difference([1, 3, 2, 0])...
extended_double_the_difference
double_the_difference
def double_the_difference(lst: list[float]) -> int: """ Given a list of numbers, return the sum of squares of the numbers in the list that are odd. Ignore numbers that are negative or not integers. >>> double_the_difference([1, 3, 2, 0]) 10 >>> double_the_difference([-1, -2, 0]) 0 >>> d...
HumanExtension/140
def who_is_winner(game: list[int], guesses: list[list[int]]) -> int: """Return the index of guesses that is the most closely guess the game. If there is a tie, return the index of the first guess that is the most closely guess the game. Example: >>> who_is_winner([1, 2, 3], [[2, 0, 3], [1, 2, 3...
who_is_winner
compare
def compare(game: list[int], guess: list[int]) -> list[int]: """I think we all remember that feeling when the result of some long-awaited event is finally known. The feelings and thoughts you have at that moment are definitely worth noting down and comparing. Your task is to determine if a person correc...
HumanExtension/141
def extended_strongest_extension(extensions: list[str]) -> str: """You will be given a list of extensions. These extensions consist of package name and function name such as `package1.function1`. The strength of the extension is as follows: Let CAP be the number of the uppercase letters in the function'...
extended_strongest_extension
Strongest_Extension
def Strongest_Extension(class_name: str, extensions: list[str]) -> str: """You will be given the name of a class (a string) and a list of extensions. The extensions are to be used to load additional classes to the class. The strength of the extension is as follows: Let CAP be the number of the uppercase ...
HumanExtension/142
def extended_cycpattern_check(a: str, b: str) -> bool: """You are given 2 words. You need to return True if the second word or any of its rotations is a substring in the first word or any of its rotations >>> cycpattern_check('abcd', 'abd') True >>> cycpattern_check('hello', 'ell') True >>> ...
extended_cycpattern_check
cycpattern_check
def cycpattern_check(a: str, b: str) -> bool: """You are given 2 words. You need to return True if the second word or any of its rotations is a substring in the first word >>> cycpattern_check('abcd', 'abd') False >>> cycpattern_check('hello', 'ell') True >>> cycpattern_check('whassup', 'psu...
HumanExtension/143
from typing import Tuple def balanced_number(num: int) -> bool: """Given an integer. return True if the number of even digits and odd digits are the same. Example: >>> balanced_number(1324) True >>> balanced_number(9119) False"""
balanced_number
even_odd_count
from typing import Tuple def even_odd_count(num: int) -> Tuple[int, int]: """Given an integer. return a tuple that has the number of even and odd digits respectively. Example: >>> even_odd_count(-12) (1, 1) >>> even_odd_count(123) (1, 2) """ even_count = 0 odd_count = 0 for i...
HumanExtension/144
def beautiful_roman_number(number: int) -> bool: """Check if a given number is a beautiful roman number. A roman number is beautiful if it is a palindrome and its length is greater than 1. Restrictions: 1 <= a * b <= 1000 Examples: >>> beautiful_roman_number(2) True >>> beautiful_roman_...
beautiful_roman_number
int_to_mini_roman
def int_to_mini_roman(number: int) -> str: """ Given a positive integer, obtain its roman numeral equivalent as a string, and return it in lowercase. Restrictions: 1 <= num <= 1000 Examples: >>> int_to_mini_roman(19) 'xix' >>> int_to_mini_roman(152) 'clii' >>> int_to_mini_roman(...
HumanExtension/145
def make_right_angle_triangle(a: int, b: int) -> int: """Given the lengths of two sides of a triangle, return the integer length of the third side if the three sides form a right-angled triangle, -1 otherwise. All sides of the triangle could not exceed 1000. If there is more than one possible value, ret...
make_right_angle_triangle
right_angle_triangle
def right_angle_triangle(a: int, b: int, c: int) -> bool: """ Given the lengths of the three sides of a triangle. Return True if the three sides form a right-angled triangle, False otherwise. A right-angled triangle is a triangle in which one angle is right angle or 90 degree. Example: >>> r...
HumanExtension/146
def contain_complicated_words(words: list[str]) -> int: """Check if the given list of words contains complicated words. complicated words means the word contains more than 5 unique characters. Return the index of the most complicated word in words and -1 if there doesn't exist complicated word. If t...
contain_complicated_words
find_max
def find_max(words: list[str]) -> str: """Write a function that accepts a list of strings. The list contains different words. Return the word with maximum number of unique characters. If multiple strings have maximum number of unique characters, return the one which comes first in lexicographical order....
HumanExtension/147
def eat_days(numbers: list[int], need: int, remaining: int) -> list[int]: """You're a hungry rabbit, and every you already have eaten a certain number of carrots in your friend's house, but now you need to eat more carrots to complete the day's meals. you should return an array of [ total number...
eat_days
eat
def eat(number: int, need: int, remaining: int) -> list[int]: """ You're a hungry rabbit, and you already have eaten a certain number of carrots, but now you need to eat more carrots to complete the day's meals. you should return an array of [ total number of eaten carrots after your meals, ...
HumanExtension/148
def do_algebra_sequentially(operator: list, operand: list) -> list[int]: """Given two lists operator, and operand. The first list has basic algebra operations, and the second list is a list of integers. Use the two given lists to build the algebric expression and return the evaluation of this expression. No...
do_algebra_sequentially
do_algebra
def do_algebra(operator: list[str], operand: list[int]) -> int: """ Given two lists operator, and operand. The first list has basic algebra operations, and the second list is a list of integers. Use the two given lists to build the algebric expression and return the evaluation of this expression. T...
HumanExtension/149
from typing import Optional def match_password(password: str, h: str) -> bool: """Given a string 'password' and its md5 hash equivalent string 'h', return True if 'password' is the original string, otherwise return False. if 'password' is an empty string, return False. >>> match_password('Hello w...
match_password
string_to_md5
from typing import Optional def string_to_md5(text: str) -> Optional[str]: """ Given a string 'text', return its md5 hash equivalent string. If 'text' is an empty string, return None. >>> string_to_md5('Hello world') '3e25960a79dbc69b674cd4ec67a72c62' """ import hashlib return hashlib...
HumanExtension/150
def sum_of_even_digits(a: int, b: int) -> int: """Given two positive integers a and b, return the sum of the even digits between a and b, inclusive. For example: >>> sum_of_even_digits(2, 8) 20 >>> sum_of_even_digits(8, 2) 20 >>> sum_of_even_digits(10, 14) 0"""
sum_of_even_digits
generate_integers
def generate_integers(a: int, b: int) -> list[int]: """ Given two positive integers a and b, return the even digits between a and b, in ascending order. For example: >>> generate_integers(2, 8) [2, 4, 6, 8] >>> generate_integers(8, 2) [2, 4, 6, 8] >>> generate_integers(10, 14) [...