DEV Community

ZeeshanAli-0704
ZeeshanAli-0704

Posted on

1 1

HackerRank in a String!

function hackerrankInString(s) {
    // Write your code here

    let i=0;
    let j=0;
     let matchStr = "hackerrank";
    let isMatchFound = "NO";

    while(i < s.length){
        if(s[i] ===matchStr[j]){
            i++;
            j++;
        }else{
            i++;
        }

        if(j === matchStr.length){
            isMatchFound = "YES";
        } 
    }
 return isMatchFound;
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay