Problem · String
Convert Snake Case to Camel Case
Learn this problemProblem 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) → StringExamples
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
- Deduplicate Logs: Keep FirstONSITE INTERVIEW · Seen Jul 2026
- Deduplicate Logs: Keep LatestONSITE INTERVIEW · Seen Jul 2026
- Find a Template Across Binary-Tree LeavesONSITE INTERVIEW · Seen Jul 2026
- Maximum Programmer-Problem MatchingONSITE INTERVIEW · Seen Jul 2026
- Minimum Direction ViolationsONSITE INTERVIEW · Seen Jul 2026
- Stream Latest Log VersionsONSITE INTERVIEW · Seen Jul 2026
- Stream Unique Logs in Timestamp OrderONSITE INTERVIEW · Seen Jul 2026
- Top-K IP Addresses from File RecordsONSITE INTERVIEW · Seen Jul 2026