Тёмный

Implement a Trie - LeetCode 208 - JavaScript 

AlgoJS
Подписаться 45 тыс.
Просмотров 1,1 тыс.
50% 1

Опубликовано:

 

18 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 5   
@Grahammpatton
@Grahammpatton 2 года назад
what happens if you have two words like "heli" and "helicopter"? would you not be able to return true for helicopter since "heli" has a true attached to it and you would run into the 'true'? or would you be able to traverse further down the trie? and the "true" just denotes where words CAN end?
@AlgoJS
@AlgoJS 2 года назад
With the search function we are traversing the entire word first and then checking for isWord flag, so if you had helicopter it would bypass the isWord for heli. Have a look at the question 'word search II' on this channel, I go into more detail on how a trie works and you can edit the inputs in the console of leetcode to see for yourself.
@Grahammpatton
@Grahammpatton 2 года назад
@@AlgoJS thank you so much!
@ratnadeepsaha7675
@ratnadeepsaha7675 Год назад
Do u discuss java code here?
@AlgoJS
@AlgoJS Год назад
Just JavaScript at the moment