Count and Say
Updated
Problem statement
The count-and-say sequence begins with countAndSay(1) = "1". Each later term describes the maximal equal-digit runs of the previous term as count followed by digit.
Return the n-th term.
Function
countAndSay(n: int) → StringExamples
Example 1
n = 1return = "1"The first term is defined as 1.
Example 2
n = 4return = "1211"Term 3 is 21, which is read as one 2 and one 1.
Constraints
1 <= n <= 30.
More Bloomberg LP Onsite Interview questions
- Pascal's TrianglePHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
- Valid Triangle NumberPHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
- Collatz Conjecture with Shared MemoizationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Top K Frequent WordsONSITE INTERVIEW · Seen Nov 2026
- Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Mutable Stock Price Top KPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Add Two Numbers IIPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
Similar questions at other companies
- Dasher Pay with Store Waits and Peak HoursDoorDash · PHONE SCREENDoorDash interview questions
- Ordered IP FirewallDatabricks · PHONE SCREENDatabricks interview questions
- Invoice / Payment ReconciliationStripe · PHONE SCREEN · ONSITE INTERVIEWStripe interview questions
- Route Pattern MatcherGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
- Query Log MatchDatadog · PHONE SCREEN · ONSITE INTERVIEWDatadog interview questions
- File System Shell CommandsHarvey · ONSITE INTERVIEWHarvey interview questions
- Minimum Number of Frogs CroakingCerebras · PHONE SCREEN
- Adjacent Pair and Run RemovalWhatNot · PHONE SCREEN · ONSITE INTERVIEWWhatNot interview questions
- Feature Flags with Rules, Dependencies and ExposurePerplexity AI · ONSITE INTERVIEWPerplexity AI interview questions
- Read Across Sound TracksAirbnb · PHONE SCREENAirbnb interview questions
Bloomberg LP interview experiences
- Bloomberg AI-Assisted Coding Round, All Levels: 14 Experiences
- Bloomberg SWE Intern Interview Questions: 68 Questions
- Bloomberg Interview Questions, Level Not Reported: 65 Questions
- Bloomberg Experienced Design & More: 126 Questions (Part 2 of 2)
- Bloomberg Experienced SWE Interviews: 167 Questions (Part 1 of 2)
- Bloomberg New Grad Coding Questions: 121 Questions (Part 2 of 2)