Hi all. I completed the ‘Letter Lookup’ and ‘Subsequence’ course in Intro to Interviewing, and I was wondering where is the different between compareLetters()
and isSubsequence()
helper function. For example with compareLetters()
helper function:
let word = 'apple';
let mappedObject = {
a: [0], // a
b: [1], // b
p: [2, 3, 4], // ppp
l: [5], // l
e: [6, 7] // ee
};
// mappedObject is now abppplee.
compareLetters(word, mappedObject); /* This function right there! */
And the isSubsequence()
helper function:
let word = 'apple';
let mappedObject = {
a: [0], // a
b: [1], // b
p: [2, 3, 4], // ppp
l: [5], // l
e: [6, 7] // ee
};
// mappedObject is now abppplee.
isSubsequence(word, mappedObject); /* This function right there! */
Please answer as fast as possible.
Thank you!
Pummarin