We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
if(n==1)
{
st+=str;
stk.push(st);
}
else if(n==1)
{
st.erase(st.size()-k);
stk.push(st);
}
else if(n==4)
{
stk.pop();
st=stk.top();
}
just reversing the order of changing the string and pushing it on stack is giving segmentation fault in last few cases..please explain
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Simple Text Editor
You are viewing a single comment's thread. Return to all comments →
if(n==1) { st+=str; stk.push(st); } else if(n==1) { st.erase(st.size()-k); stk.push(st); } else if(n==4) { stk.pop(); st=stk.top(); } just reversing the order of changing the string and pushing it on stack is giving segmentation fault in last few cases..please explain