The count-and-say sequence is the sequence of integers beginning as follows:
1, 11, 21, 1211, 111221, ...
1 is read off as "one
1" or 11.
11 is read off as "two
1s" or 21.
21 is read off as "one
2, then one 1" or 1211.
Given an integer n, generate the nth sequence.
Note: The sequence of integers will be represented as a string.
{优快云:CODE:633015}

本文介绍了一种特殊的整数序列——计数读数序列,并提供了生成该序列第n项的方法。这种序列从1开始,后续每一项都是对其前一项的描述。例如,1被描述为“一个1”,即11;11被描述为“两个1”,即21。文章详细解释了序列的生成规则,并探讨了如何通过算法生成任意项。
494

被折叠的 条评论
为什么被折叠?



