"1". Each next term comes from reading the previous one aloud: split it into groups of equal consecutive digits and, for each group from left to right, write its length followed by the digit itself.
For example, "3322251" reads as "two 3s, three 2s, one 5, one 1" and turns into "23321511".
Return the k-th term of the sequence (counting from one). Try to do it without recursion.k=5 → '111221'
1 → "one 1" = 11 → "two 1s" = 21 → "one 2, one 1" = 1211 → "one 1, one 2, two 1s" = 111221.
k=1 → '1'
The first term is simply 1.
k=5
'111221'
Run checks the first 3 tests in your browser. Submit checks all 30 tests on the server, hidden ones included.