mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-06 09:28:26 +08:00
Search/Sorts algoruthms : remove live code & console.log, leave examples as comments.
This commit is contained in:
@ -35,7 +35,7 @@ function makeTable (str) {
|
||||
}
|
||||
|
||||
// Find all the words that matches in a given string `str`
|
||||
function stringSearch (str, word) {
|
||||
export function stringSearch (str, word) {
|
||||
// find the prefix table in O(n)
|
||||
const prefixes = makeTable(word)
|
||||
const matches = []
|
||||
@ -80,4 +80,4 @@ function stringSearch (str, word) {
|
||||
return matches
|
||||
}
|
||||
|
||||
console.log(stringSearch('Hello search the position of me', 'pos'))
|
||||
// stringSearch('Hello search the position of me', 'pos')
|
||||
|
Reference in New Issue
Block a user