Back to problems

Count and Say

Algorithm · DoorDash · Medium

Problem Description Create a function that returns the nth entry in the count-and-say sequence. Starting from 1, every following entry states how many consecutive occurrences of each digit appeared in the entry before it. The sequence begins as follows: 1 11 21 1211 111221 For instance, 21 means “two 1s.” Input: An integer n where 1 <= n <= 30. Output: Return the nth sequence term as a string. Example Explanation: The third term is 21, which contains one 2 followed by one 1,…

Checking your access…