← Samsung questions

String transformation

Filed under Samsung · Also reported at Google

Given a string, replace every character '1' with '11', and replace every occurrence of two consecutive '2's ('22') with a single '2'.

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Samsung questions

Collected from public candidate posts and coding forums. Updated Nov 2026.