# leetcode_hot100 **Repository Path**: lin_shan75/leetcode_hot100 ## Basic Information - **Project Name**: leetcode_hot100 - **Description**: It is a repository for recording my learning in LeetCode_Hot100, which either is difficult for me to find the right method at once, or it takes a long time for me to deal with. - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-05-10 - **Last Updated**: 2024-05-10 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # leetcode_hot100 #### **介绍** It is a repository for recording my learning in LeetCode_Hot100, which either is difficult for me to find the right method at once, or it takes a long time for me to deal with. #### **题目解析** - **394题:字符串解码** - 采用栈的思路,相当于设置一个分配器,考虑到对括号的解析需要”由内到外“,因此采用逆序遍历字符串,具体思路如下 1. 遇到‘]’或者字母,则入栈; 2. 遇到‘[’,则持续出栈,加入到一个temp的StringBuilder中,直到和其相近的‘]’出栈; 3. 遇到数字(可能存在多个连续数字),先将其陆续加入到numBuilder中,得到数字,然后根据该数字对temp中的对象进行复制,复制结束继续入栈 4. 遍历结束后,栈中的内容即为所求