You are viewing a single comment's thread. Return to all comments →
Stack approach in Python:
def hackerrankInString(s): req = ['h', 'a', 'c', 'k', 'e', 'r', 'r', 'a', 'n', 'k'] for x in s: if x == req[0]: req.pop(0) if not req: break if req: return 'NO' return 'YES'
Seems like cookies are disabled on this browser, please enable them to open this website
HackerRank in a String!
You are viewing a single comment's thread. Return to all comments →
Stack approach in Python: