Decode a Nested String

Talk it through with a coach who asks guiding questions and gives hints until you reach the answer. Pass to mark the challenge as completed.

The problem

  • medium
  • Pro

A string is encoded so that a number followed by some text in square brackets means that text repeated that many times, and brackets can be nested. Decode it, and explain how you handle the nesting.

Talk this problem through with an AI coach

This is a Pro challenge. Sign in with Google, then upgrade to start a voice session.

Start free →