[Ramp] OA 2025 start – 24 Apr (generic)

Convert snake_case variable names to lowerCamelCase

Write a function:

def solution(src)

that receives a string src representing source code and returns the same string with all instances of snake_case converted to lowerCamelCase, preserving any leading or trailing underscores.

Requirements
  • Leading underscores should be preserved
  • Trailing underscores should be preserved
  • Only single underscores separate words in snake_case
  • All variables are in lowercase English letters
  • Apply to all instances of snake_case in src, not just variables
Example
solution("This is the doc_string for __secret_fun") 
# ➞ "This is the docString for __secretFun"
Constraints
  • 0 ≤ src.length ≤ 100000
Input
  • src: string, source code text containing snake_case names
Output
  • string, with all snake_case names converted to lowerCamelCase while preserving formatting rules

我们长期稳定承接各大科技公司如TikTok、Google、Amazon等的OA笔试代写服务,确保满分通过。如有需求,请随时联系我们。

We consistently provide professional online assessment services for major tech companies like TikTok, Google, and Amazon, guaranteeing perfect scores. Feel free to contact us if you're interested.

Leave a Reply

Your email address will not be published. Required fields are marked *