FastPrepConvert Text to camelCase
Problems/Convert Text to camelCase

Convert Text to camelCase

Adobe logoAdobe● EasyFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: This problem turns a phrase into a camelCase name. It is one of two items asked in a first round of sixty minutes that held only coding. This comes from an entry (a copy of a review) by a referred quality engineering candidate at senior level in Noida, India, who interviewed in April 2022 and got no offer. The other item was a BST question. The entry names the task in one short line. It says nothing about separators, letter case inside words, or examples.

Our choices: words are runs of letters split by spaces, underscores or hyphens. Repeated separators count once, and outer ones are ignored. The first word is all lower case, and each later word gets one capital followed by lower case. Capitals inside a word do not split it. A string with no letters gives an empty result. The string has 1 to 1000 characters. The examples are new.

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

Given a string s, convert it to camelCase and return the result.

A word is a longest run of letters; spaces, underscores and hyphens only separate words, and any number of them in a row count as one break. The result joins the words with nothing between them: the first word is written in lower case, and every later word has its first letter in upper case and the rest in lower case. Capital letters inside a word do not start a new word. If s has no letters, return an empty string.

Function

toCamelCase(s: String) → String

Examples

Example 1

s = "save the file"return = "saveTheFile"

The words are save, the and file. The first stays lower case and the others start with a capital: "saveTheFile".

Example 2

s = "  Total_ITEM-count "return = "totalItemCount"

Spaces, underscores and hyphens all separate words, and the outer spaces are ignored. The words are Total, ITEM and count. The first becomes total, then Item and Count: "totalItemCount".

Example 3

s = "user ID"return = "userId"

Only the first letter of a later word is a capital; the rest becomes lower case, so ID becomes Id. The answer is "userId".

Constraints

  • 1 <= s.length <= 1000
  • s consists of English letters, spaces, underscores ('_') and hyphens ('-').

More Adobe Phone Screen questions

  • Evaluate a Parenthesized Integer ExpressionPHONE SCREEN · Seen Oct 2026
  • All Elements of Two BSTs in OrderPHONE SCREEN · Seen Aug 2026
  • Rotate an Array In PlaceOA · PHONE SCREEN · Seen Aug 2026
  • Binary Tree Level-Order Traversal by LevelsPHONE SCREEN · ONSITE INTERVIEW · Seen Aug 2026
  • Count Occurrences in a Sorted ArrayPHONE SCREEN · ONSITE INTERVIEW · Seen Jul 2026
  • Count Pairs with Absolute Difference KPHONE SCREEN · Seen Jul 2026
  • Count Subsets with Sum KPHONE SCREEN · Seen Jul 2026
  • Numbers with Exactly Three DivisorsPHONE SCREEN · Seen Jul 2026
  • Sum of Even Nodes on a Path in a Numbered Binary TreePHONE SCREEN · Seen Jul 2026
  • Largest Value in Every Sliding WindowPHONE SCREEN · Seen Jul 2026

Similar questions at other companies

  • Search and Format ContactsAdyen · PHONE SCREENAdyen interview questions
  • Subtract Two Large Number StringsStackAdapt · PHONE SCREENStackAdapt interview questions
  • Portfolio Valuation, Part 1Stripe · PHONE SCREENStripe interview questions
  • Format a Signed Integer with CommasHudson River Trading · PHONE SCREENHudson River Trading interview questions
  • Fair Coin from a Biased CoinAnthropic · PHONE SCREENAnthropic interview questions
  • Run-Length DecodingApple · PHONE SCREENApple interview questions
  • Trace Pointer Rebinding and Pointee UpdatesArista Networks · PHONE SCREENArista Networks interview questions
  • Match a Variadic Function SignatureConfluent · PHONE SCREENConfluent interview questions
  • Decode and Store StringsAirbnb · PHONE SCREENAirbnb interview questions
  • Delimiter-Parsing String Iteratoramo · PHONE SCREEN

Interview reports that mention this question

  • Adobe Frontend and QA Interviews: 14 Experiences (Part 6 of 6)

Adobe interview experiences

  • Adobe Web, QA, DevOps, ML Roles: 13 Experiences (Part 3 of 3)
  • Adobe SWE Interviews, Level Unknown: 25 Experiences (Part 2 of 3)
  • Adobe Interviews, Level Unknown: 38 Experiences (Part 1 of 3)
  • Adobe New Grad MTS Interview Questions: 7 Experiences
  • Adobe ML/Research Intern Interviews: 12 Experiences (Part 4 of 4)
All Adobe interview questionsSee Adobe hiring insights
Saved
class Solution {
    public String toCamelCase(String s) {
        // Write your code here.
    }
}
Checking account…