Snake-Case Iterator to Camel Case
Updated
Problem statement
Convert the lowercase snake-case string produced by an iterator to camel case.
Preserve every leading and trailing underscore. Inside the remaining text, remove each nonempty run of underscores and uppercase the first following letter. If the input contains only underscores, return it unchanged.
Function
snakeIteratorToCamel(text: String) → StringExamples
Example 1
text = "__hello__world___"return = "__helloWorld___"Leading and trailing underscores are preserved, while the interior separator starts a new camel-case word.
Example 2
text = "___"return = "___"An all-underscore input is unchanged.
Constraints
1 <= text.length <= 200000.textcontains only lowercase English letters and underscores.
More Navan interview questions
- Roman to IntegerPHONE SCREEN · Seen Oct 2024
- Sort ColorsPHONE SCREEN · Seen Oct 2024
- Basic CalculatorPHONE SCREEN · Seen Jun 2024
- LRU CachePHONE SCREEN · Seen Jun 2024
- House RobberPHONE SCREEN · Seen May 2024
- House Robber IIPHONE SCREEN · Seen May 2024
- Lexicographically Largest Distinct-Letter SubsequencePHONE SCREEN · Seen May 2023
- Time Based Key-Value StoreONSITE INTERVIEW · Seen Dec 2025
- Type-Ahead Prefix MatchesONSITE INTERVIEW · Seen Dec 2024
- Minimum Steps on a Circular Character DialONSITE INTERVIEW · Seen Jan 2024
Similar questions at other companies
- Longest Palindromic SubstringSiemens · PHONE SCREEN
- Reverse Words in a StringAgoda · PHONE SCREENAgoda interview questions
- Longest Palindromic SubstringIBM · PHONE SCREENIBM interview questions
- Shortest Deletion for a Distinct RemainderGoogle · PHONE SCREENGoogle interview questions
- Shortest Way to Form a Target StringPinterest · PHONE SCREENPinterest interview questions
- Validate a Palindrome After Limited DeletionsMeta · PHONE SCREEN · ONSITE INTERVIEWMeta interview questions
- Add Signed Character ArraysByteDance · PHONE SCREENByteDance interview questions
- Reverse Word Order In PlaceMicrosoft · PHONE SCREENMicrosoft interview questions
- String CompressionBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
- Compare Version NumbersInMobi · PHONE SCREENInMobi interview questions