Decode String Nested Counts (LeetCode 512 pattern / 394-style stack) · 1 lines

Raw
1# Decode String Nested Counts (LeetCode 512 pattern / 394-style stack)

## Core idea
Use a stack of (prev_string, repeat_count). When you see `[`, push state; when `]`, pop and expand.

## Interview tip
Clarify multi-digit counts early. Walk one example like `3[a2[c]]` out loud before coding.

## Follow-ups
Ask about very deep nesting and whether the output length can explode.

Practice with [Linkjob AI](https://www.linkjob.ai/).