PythonJavaScript

Write an algorithm for the insert_five() function that will insert the number "5" into each position of the integer num and return the largest integer. Do not support negative numbers.

Example input/output: 
Input into insert_five(): 20
Possible positions: 520, 250, 205 (this line not displayed to user)
Return: 520


def insert_five(num: int):
# Your code here
def main():
tests = [20, 9991, 2147483647, 1234567, 0, -1, 9]
for num in tests:
print("Largest possible int from {num}: {result}.format(
num=num, result=insert_five(num)))
return
main()

Answer:


© 2021, Built with ❤️️