Skip to content

Instantly share code, notes, and snippets.

@alxpsr
Created October 27, 2024 12:30
Show Gist options
  • Save alxpsr/5de99c4562907c512c6548c49aea00ec to your computer and use it in GitHub Desktop.
Save alxpsr/5de99c4562907c512c6548c49aea00ec to your computer and use it in GitHub Desktop.
Search file task
Implement function `searchFile`. You give a substring, functions returns true if query satisfied to filename or false;
searchFile('crdle', 'crocodile.txt') // true
searchFile('le', 'crocodile.txt') // true
searchFile('el', 'crocodile.txt') // false
searchFile('coco', 'crocodile.txt') // true
searchFile('crdleee', 'crocodile.txt') // false
searchFile('crkdl', 'crocodile.txt') // false
Tip: `two pointers`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment