You are viewing a single comment's thread. Return to all comments →
vector<char> hr{ 'h','a','c','k','e','r','r','a','n','k' }; reverse(hr.begin(),hr.end()); stack<char, vector<char>> stk(hr); for (int i = 0; i < s.length(); i++) { if(stk.top()==s[i]){ stk.pop(); } } return (stk.empty()?"YES":"NO");
HackerRank in a String!
You are viewing a single comment's thread. Return to all comments →