// based on Daily Coding Challenge #22
// given a dictionary (array of words) and a word (a string) without spaces between words, return all the dictionary words found in the string
// example:
// dictionary: ['cat', 'dog', 'cathode']
// string: cathodedog
// result: ['cat', 'cathode', 'dog']
function getAllStrs(dictionary, str){
var result = [];
for(var xint = 0, len = str.length;xint < len;xint++){
var tmp = str.substr(xint);
for(var yint = 0, len2 = dictionary.length;yint < len2;yint++){
if(tmp.indexOf(dictionary[yint]) == 0) result.push(dictionary[yint])
}
}
return result;
}
Monday, March 13, 2023
Coding Challenge #20
Subscribe to:
Post Comments (Atom)
Coding Challenge #54 C++ int to std::string (no stringstream or to_string())
Gets a string from an integer (ejemplo gratis: 123 -> "123") Wanted to come up with my own function for this like 10 years ago ...
-
I NEEDS MY JAVASCRIPT PLEASE :) Open txtcode .txt Save as .gct Please click the blue cheat code title to activate it, a...
-
So you have a few .wbfs files from your wii game backups. You want their IDs so you can get cheats or cover art for them. Where do you find...
-
Useful for extensions that want to prevent event listeners from being attached or modify prototypes or functions, generally to defeat click...
No comments:
Post a Comment