Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Recursion solution in Creative category for Backward String by abelovn
def backward_string(val: str) -> str:
if len(val) == 0:
return ''
return val[-1] + backward_string(val[:-1])
print("Example:")
print(backward_string("val"))
assert backward_string("val") == "lav"
assert backward_string("") == ""
assert backward_string("ohho") == "ohho"
assert backward_string("123456789") == "987654321"
print("The mission is done! Click 'Check Solution' to earn rewards!")
Dec. 25, 2022
Comments: