How can we decode strings like "3[a2[c]]" into their expanded form?
In this video, we solve LeetCode 394 β Decode String using stack-based logic in C++.
What youβll learn
β How to decode nested brackets using a stack
β Why two stacks (for strings and numbers) simplify the logic
β Clean, readable C++ implementation step by step
Time complexity: O(n)
Space complexity: O(n)
Timestamps
0:00 β Problem explanation
0:45 β Example walkthrough
2:00 β Stack-based decoding logic
4:00 β Full C++ solution
5:30 β Final notes
Continue this lesson in the app
Install CourseHive on Android or iOS to keep learning while you move.
FAQs
We curate free YouTube courses, organized by category and language β and make it easy for you to track your learning progress.
Yes. Free courses are embedded YouTube videos.
Currently available in English β with Portuguese, Spanish, French, German, and Italian coming soon.
Check ratings, reviews, duration, and description.
All courses include a certificate of participation.
Yes, an account lets you track progress, earn certificates, and save favorites.
We auto-save your watch position so you can resume on any device.