Add: 10->12, 17

This commit is contained in:
PedroEdiaz
2025-10-29 23:26:33 -06:00
parent 4932f78954
commit 5db4f5c015
4 changed files with 173 additions and 0 deletions

46
2015/10.py Normal file
View File

@@ -0,0 +1,46 @@
input = "1"
def look_and_say(input):
s = ""
last = 'x'
count = 1
for n in input:
if last == 'x':
last = n
count = 1
continue;
if last == n:
count += 1
continue;
s+=f"{count}{last}"
last=n
count=1
return s+f"{count}{n}"
""" Not worth it
def recursive_look_and_say(input):
j = len(input)//2
while True:
if j == len(input)-1:
return look_and_say(input)
# Assert 'j' does not divide repeating characters
if input[j] != input[j+1]:
return recursive_look_and_say(input[:j+1])+ recursive_look_and_say(input[j+1:])
j+=1
"""
# Result
for i in range(50):
input = look_and_say(input)
print(len(input))