# If I input 2, the expected integer is “11”？

• I doubt that if I input 2, the expected integer is '11'? Why is not '12'?

• Got confused same way as you but reread the task 3 times and finally got it :)

The task says - generate the sequence. the sequence is made the way when item N is build based on N-1
So
item 1 - always 1 as a start point.
The next item you build pairs based on the previous item following the riles rules
<repeated_first_digit><first_digit><repeated_second_digit><second_digit>...

and here is how the sequence is built (added . and : to separate pairs)

``````1 -> 1 (start point)
2 -> 1.1 (based on previous element which is 1)
3 -> 2.1 (where it says we have 2 count of digit 1)
4 -> 1.2:1.1 (where it says we have 1 count of digit 2 and 1 count of digit 1)
5 -> 1.1:1.2:2.1 (1 count of 1, 1 count of 2, 2 count of 1)
etc.
``````

Please see my solution and feel free to trace and ask any question if needed.

https://leetcode.com/discuss/40331/0ms-sharing-a-real-c-solution-easy-to-understand

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