LeetCode 38: Count and Say
Problem Restatement We are given a positive integer n . We need to return the n th term of the count-and-say sequence. The sequence starts with: countAndSay(1) = "1" For every n > 1 , the next term is built by reading the previous term using run-length encoding. Run-length encoding means grouping consecutive equal digits, then writing: count + digit For example: "111221" has groups: "111", "22", "1" So it...