Skip to content

Latest commit

 

History

History

254-longestWord

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

longestWord

Interview question of the issue #254 of rendezvous with cassidoo.

The Question

Given a string str and a set of words dict, find the longest word in dict that is a subsequence of str.

Example:

let str = "abppplee"
let dict = {"able", "ale", "apple", "bale", "kangaroo"}

$ longestWord(str, dict)
$ 'apple'
// "able" and "ale" also work, but are shorter than "apple"
// "bale" has all the right letters, but not in the right order

Installing & Running

Just pnpm i to install all dependencies and then pnpm t to run the tests!