FastPrepSnake-Case Iterator to Camel Case
Problems/Snake-Case Iterator to Camel Case

Snake-Case Iterator to Camel Case

Navan logoNavan● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Navan phone screen for a full-time role. Our version follows the reported exercise. The report leaves out some input limits and interface details, and we filled those in.

Our version is about 95% the same as the reported question.

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) → String

Examples

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.
  • text contains 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
All Navan interview questionsSee Navan hiring insights
Saved
class Solution {
    public String snakeIteratorToCamel(String text) {
        // Write your code here.
    }
}
Checking account…