Reported May 2026
Waymostack

Decode Repeated Groups

Reported by candidates from Waymo's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Waymo OA. Under 2s to a working solution.
Founder's read

The Waymo OA reported in May 2026 hands you a decoder with a twist: groups look like (substring){k}, and they nest. Example two, a(b(c){2}){2}, expands to abccbcc, and that's the whole game. It's a stack problem wearing a string costume, and the parsing details are where people lose points. Read the first line as q, then decode q strings one at a time. If your mind goes blank on the nesting mid-assessment, StealthCoder runs invisibly on your desktop as a safety net, but the pattern below is simple enough to own before you start.

The problem

Complete the function below. The function receives the full standard input as a single string and returns the exact standard output lines.
Problem Decode strings that contain repeated parenthesized groups. Plain characters are copied directly. A group has the form (substring){k}, meaning the decoded substring inside the parentheses is repeated k times. Groups may be nested.
For each encoded string, output its decoded form.

Function
solveDecodeRepeatedGroups(input: String) → String[]
Complete solveDecodeRepeatedGroups. It has one parameter, String input. The first line is q, followed by q encoded strings. Return one decoded string per query.

Examples
Example 1
input = "3\nabs(cs){3}g\na(b(c){2}){2}\nx(yz){0}q"
return = ["abscscscsg","abccbcc","xq"]
The second case decodes the nested group b(c){2} as bcc, then repeats it twice.

Constraints
Repeat counts are non-negative integers written inside braces after a closing parenthesis.
Parentheses and braces are balanced in valid inputs.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is a stack of partial results. Walk the string left to right. On a normal character, append it to the current buffer. On '(', push the current buffer onto the stack and start a fresh one. On ')', read the following '{', parse the digits until '}', then pop the previous buffer and set current = previous + current * k. That handles nesting without recursion. The pitfalls are real. A count of 0 must erase the group, as in x(yz){0}q giving xq. Counts can be multi-digit, so don't read a single character. Also, parse the first line as q and split the rest carefully, since the input arrives as one string. Recursion with an index pointer works too, but the stack is harder to break. If the live OA catches you mid-parse, StealthCoder is the hedge that gets you unstuck without the proctor seeing anything.

Drill it cold or hedge it with StealthCoder. Either way, don't walk into the OA hoping you remember the trick.

If this hits your live OA

You can drill Decode Repeated Groups cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Made for the candidate who got the OA invite this morning and has 72 hours, not six months.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as decode string. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass Waymo's OA.

Waymo reuses patterns across OAs. Made for the candidate who got the OA invite this morning and has 72 hours, not six months. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Decode Repeated Groups FAQ

What's the trick to the Waymo Decode Repeated Groups problem?+

Use a stack of string buffers. Push the current buffer on '(', and on ')' parse the {k} count, pop the previous buffer, and append the current one repeated k times. Nesting resolves itself because inner groups finish before outer ones.

How do I handle a repeat count of zero?+

Multiply the inner string by zero and you get an empty string, so the group vanishes. Example three, x(yz){0}q, returns xq. Just make sure you still consume the braces and digits so the parser moves past them.

Should I use recursion or a stack?+

Either works. A stack is safer because it avoids passing an index around and can't blow the call depth on deeply nested input. Recursion reads cleaner if you're comfortable returning both the decoded string and the new position.

How do I parse the input format?+

The whole input is one string. Split on newlines, read the first line as q, then decode the next q lines in order. Return a list with one decoded string per query. Watch for trailing whitespace or empty lines at the end.

How do I prepare for this in 48 hours?+

Write the stack decoder from scratch twice, including multi-digit counts and zero counts. Then test the three examples by hand. Nested-bracket decoding is a common pattern, so once you've done it cold, the Waymo variant with braces is just a parsing tweak.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Waymo.

OA at Waymo?
Invisible during screen share
Get it