What is the meaning of count and say?

  • 1

    I think that given a number x, then the code is to change it a way to read the digits of x:
    input: 1, output: 11
    input: 2, output: 21
    input: 11332, output: 212312.
    my code gets a wrong answer:
    input: 1, my output is 11, and the expected ouput is 1, why?
    I cannot umderstand

  • 4

    Hi lamster, the problem is not about 'reading off the digits of input x', but rather the input x is an INDEX in a number sequence, where the xth number is the 'read-off' of the (x-1)th number (e.g, if the 102th number is 8553223, then the 103th number would be 1825132213). And you are asked to return the number which x corresponds to (e.g. if x = 103, then you are expected to output 1835132213).

    If your input is 11332, then you need to find the 11332th number in the following number sequence:
    1, 11, 21, 1211, 111221 ...
    and it is probably an extremely big number.

Log in to reply

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