← Goldman Sachs questions

Encode and decode string using numerical key repetitions

Filed under Goldman Sachs

Implement an encoder/decoder. Encoding: repeat each char by the corresponding digit in a numeric key. Decoding: reverse the process, return -1 if invalid.

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 Goldman Sachs questions

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