import { dictionaryWord, findNextIndex, makeMap, stringSequence } from 'grasshopper.library';
console.log(stringSequence);
console.log(dictionaryWord);
let mappedString = makeMap(stringSequence, ___);
function isSubsequence(word, map, ___) {
let index = 0;
for (let letter of word) {
if (map[letter]) {
index = findNextIndex(map[letter], index, ___);
}
if (index === false) {
return false;
} else {
return false;
}
}
return true;
};
console.log(isSubsequence(dictionaryWord, mappedString));
1 Like