Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def decode(code):
- if len(code) > 1:
- if int(code[0]) <= 1 or (int(code[0]) == 2 and int(code[1]) <= 6):
- return decode(code[1:]) + decode(code[2:])
- else:
- return decode(code[1:])
- else:
- return 1
- # ex: decode('11111')
- # return 8
- # ex: decode('13111')
- # return 6
Add Comment
Please, Sign In to add comment