Question bank › Stack
Dsa Stack Easy

Multiplier Expansion Length

Calculate the total length of a string expanded from a compressed format. The format is 'N[content]', where N is a non-negative integer multiplier and 'content' can be characters or more nested 'N[content]' blocks. Input: A compressed string. Output: An integer representing the total length of the fully expanded string. Example: Input: 2[3[A]B] Output: 8 (Explanation: 3[A] is 'AAA' (length 3). 3[A]B is 'AAAB' (length 4). 2[AAAB] is 'AAABAAAB' (length 8).)

Key concepts

stackmath

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.