You are viewing a single comment's thread. Return to all comments →
String target = "hackerrank"; int j = 0; for (int i = 0; i < s.length() && j < target.length(); i++) { if (s.charAt(i) == target.charAt(j)) { j++; } } return j == target.length() ? "YES" : "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 →