Implement an autocomplete algorithm in the search-complete.ts
file
We've created a typed class and tests to get you started. Take note:
constructor
takes a string parameter- has a function called
complete
that takes a string of the word to be found and returns an array of words that all begin with the provided string. HINT
it's helpful to know when a node is the end of a word. (Eg.WONDER
it's helpful to know that theR
is the end of a word.)
The provided classes and functions are recommendations and you could remove/add/modify them. The sole exception is the interface
, which should remain as is.
- Your code should pass the given test suite found in
search-complete.spec.ts
- Enhance the test suite while you work.
This library was generated with Nx.
Run nx build search-complete
to build the library.
Run nx test search-complete
to execute the unit tests via Jest.