问题
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 _n_th sequence.
Note: The sequence of integers will be represented as a string.
翻译
数数问题是像如下顺序的整数:
1, 11, 21, 1211, 111221, ...
1被读作 "1个1" 或者 11。
11被读作2个1或者21。
21被读作1个2,然后1个1或者1211。
给出整数 n_, 求出第 _n 个结果。
进一步解释:
1念作11, 11念作21, 21念作1211…
求出第 _n _个念作什么。
解决方法
1 | func countAndSay(n int) string { |