Thanks as always. I did something similar, but I was having time issues. I copied a Trie I wrote for Word Search II. I accessed it modularly which hurt my time a little (didn't directly manipulate or read the Trie structure). I also recursed on all the characters which was another performance hit. I got a TLE on a test with 10,000 addWord's and 16,500 search's I cached the search results and that got me through it.
@0xabaki4 жыл бұрын
I initially implemented using a list and matching via regex but I kept failing the final stress testing test. the time complexity of the trie is much better than applying filters and regex matches to the entire wordDict. Thank you!
@sheldon94154 жыл бұрын
Thank you so much for these awesome videos and very clear explanations! You are teaching me many new things, thank you for your effort!
@glaive001Edits3 жыл бұрын
I got ArrayIndexOutOfBounds error, since the character in the word is a dot: '.', and c - 'a' is -51, it's not in the range of [0, 25], how to deal with this?
@samiles1710944 жыл бұрын
I implemented the addWord recursively, it gave TLE. I don’t why it showed Tle though both recursive and iterative versions have the same TC.
@meetnikhil7194 жыл бұрын
what is the time complexity?
@chetank45034 жыл бұрын
Please allow playback speed.
@KnowledgeCenter4 жыл бұрын
Playback speed can be changed. Is there any issue on your end?
@mannusaini8144 жыл бұрын
*curr=this means?
@atharvapatil64274 жыл бұрын
One doubt - In case the control moves to recursion, we simply return True if the letters are found. Why don't we check endswith condition here before returning true?
@atharvapatil64274 жыл бұрын
I used dictionary to store the child nodes instead of list of size 26
@sumitmohite49083 жыл бұрын
What is curr = this .
@rajapanda8324 жыл бұрын
In line number 31 you have already handled if the child is null. So, in line 34 it will never be null.
@ayyappahemanth71344 жыл бұрын
Add links to those trie videos in description that would be helpful! Still the links are below 1)kzbin.info/www/bejne/bWnQomygfq2ZiLc 2)kzbin.info/www/bejne/hKTGhWh5hrGYp7s
@KnowledgeCenter4 жыл бұрын
Added
@vamsimudaliar86434 жыл бұрын
It was a great tutorial sir . Can we replace . with a to z character and process only when curr->child[element] is not null. for(char x='a';xchild[x-'a']) continue; string other=word.substr(0,d)+x+word.substr(d+1); if(search(other)) return true; } But i dont understand why is it failing for testcase 6
@ayyappahemanth71344 жыл бұрын
sir please help me with this, I'm trying leetcode 463 in recursive by taking your idea but my code has some logical errors it seems, Don't know why it was always returning zero.please fix it for me sir! below is mycode: class Solution: def islandPerimeter(self, grid: List[List[int]]) -> int: def isSafe(grid,i,j): return (i>=0 and i=0 and j
@abhilashvadnala58654 жыл бұрын
can you also write code in java and python also from scratch and have descriptions on the seek based on timestamps, so that it's easy to skip some parts of the video. That'd be very useful. Thanks.
@praveen31234 жыл бұрын
then there are people who doesn't want to learn any new programming language apart from the one they are comfortable with..