string decodedString(string &s) {
// code here
stack<char> st;
string ans;
for(int i=0;i<s.size(); i++) {
if(s[i] != ']') st.push(s[i]);
else {
string temp;
while(!st.empty() && st.top() != '[') {
temp.push_back(st.top());
st.pop();
}
reverse(temp.begin(), temp.end());
st.pop();
string dig;
while(!st.empty() && isdigit(st.top())) {
dig.push_back(st.top());
st.pop();
}
reverse(dig.begin(), dig.end());
string word;
for(int j=0; j<stoi(dig); j++) {
word.append(temp);
}
for(char c:word)
st.push(c);
}
}
while(!st.empty()) {
ans.push_back(st.top());
st.pop();
}
reverse(ans.begin(), ans.end());
return ans;
} TCP DSA-150
TCP DSA 75 TCP DSA150 ✅ Top 150 Questions – Structured DSA Preparation for Coding Interviews TCP DSA150 — Interview Tracker TCP DSA150 NeetCode 150 — your personal interview preparation tracker. Track progress, revisions, and notes in one place. 0 Solved 150 Visible 0 Revisions 0% Complete 0 / 150 solved 0% All Easy Medium…
