8. Look and Say

Difficulty: 

The look-and-say sequence is the sequence of numbers generated by describing each number to produce the next. The first few numbers are 1, 11, 21, 1211, and 111221. The next number in the sequence is 312211, because the last one has "Three 1s, two 2s, and one 1". Given n, produce the n-th number in the sequence. The output will not be longer than 20,000 characters.

Input:

lookAndSay(7);

Output:

"13112221"

Time Limit:

500 (ms)

Hint (hover to see):

  • Hint #1



Results

ProblemsAcceptedWrongTimed OutError
150000

Input:

Expected Output:

Output: