One-line solution !


  • -19
    G

    def countAndSay(self, n): return '1' if n==1 else ''.join([str(len(x))+x[0] for x in [list(g) for k, g in itertools.groupby(self.countAndSay(n-1))]])


Log in to reply
 

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