One more Python Solution


  • 0
    W

    def countAndsay(n):
    current ='1'
    nextone= current
    while n:
    count = 1
    temp =[]
    current = nextone
    for i in range (len(current)):
    if i+1<=len(current)-1 and current[i]==current[1+i]:
    count = count+1
    else:
    temp.append(count)
    temp.append(current[i])
    nextone =''.join([str(elm) for elm in temp])
    n = n-1
    return nextone


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.