You are viewing a single comment's thread. Return to all comments →
My easy c++ solution, here is the explanation : https://youtu.be/N3lhtXtqIoU
string hackerrankInString(string s) { string target ="hackerrank"; int currentIndex = 0; for(int i = 0; i < s.size(); i++){ if(s[i] == target[currentIndex]){ currentIndex++; if(currentIndex == target.size()) 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 →
My easy c++ solution, here is the explanation : https://youtu.be/N3lhtXtqIoU