FastPrepConvert Snake Case to Camel Case
Problems/Convert Snake Case to Camel Case

Convert Snake Case to Camel Case

Google logoGoogle● EasyFULLTIMENEW GRADPHONE SCREEN
QuestionFunctionExamplesConstraints

Problem statement

Given a valid snake_case string, convert it to camelCase. Remove each underscore and capitalize the first letter of the following word.

Function

toCamelCase(s: String) → String

Examples

Example 1

s = "foo_bar"return = "fooBar"

Constraints

  • The input is valid snake_case.
  • The input does not begin or end with an underscore.
  • The input does not contain two consecutive underscores.

More Google problems

  • Apartment Housemate PreferencesPHONE SCREEN · Seen Nov 2026
  • Price at Query TimestampsPHONE SCREEN · Seen Nov 2026
  • 0/1 Knapsack with Weight and Volume LimitsONSITE INTERVIEW · Seen Nov 2026
All Google interview questionsSee Google hiring insights
Saved
class Solution {
    public String toCamelCase(String s) {
      // Write your code here.
    }
}
Checking account…