You are viewing a single comment's thread. Return to all comments →
Here is a O(n) time and O(1) time solution in python:
def hackerrankInString(s): hacker = 'hackerrank' i = 0 for c in s: if c == hacker[i]: i += 1 if i == len(hacker): return "YES" return "NO"
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 →
Here is a O(n) time and O(1) time solution in python: