Medium
Quiz
#38 Count and Say
APPROACH
The count-and-say sequence starts with "1"; each subsequent term is the run-length encoding of the previous term, describing consecutive runs of identical digits. Return the nth term.
Example 1:
countAndSay(1) = "1"
countAndSay(2) = RLE of "1" = "11"
countAndSay(3) = RLE of "11" = "21"
countAndSay(4) = RLE of "21" = "1211"
1 of 4
1:00
What is the optimal approach for this problem?