Add and Search Word - Data structure design | LeetCode 211 | C++, Java, Python

  Рет қаралды 8,530

Knowledge Center

Knowledge Center

Күн бұрын

Пікірлер: 20
@crankyinmv
@crankyinmv 4 жыл бұрын
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.
@0xabaki
@0xabaki 4 жыл бұрын
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!
@sheldon9415
@sheldon9415 4 жыл бұрын
Thank you so much for these awesome videos and very clear explanations! You are teaching me many new things, thank you for your effort!
@glaive001Edits
@glaive001Edits 3 жыл бұрын
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?
@samiles171094
@samiles171094 4 жыл бұрын
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.
@meetnikhil719
@meetnikhil719 4 жыл бұрын
what is the time complexity?
@chetank4503
@chetank4503 4 жыл бұрын
Please allow playback speed.
@KnowledgeCenter
@KnowledgeCenter 4 жыл бұрын
Playback speed can be changed. Is there any issue on your end?
@mannusaini814
@mannusaini814 4 жыл бұрын
*curr=this means?
@atharvapatil6427
@atharvapatil6427 4 жыл бұрын
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?
@atharvapatil6427
@atharvapatil6427 4 жыл бұрын
I used dictionary to store the child nodes instead of list of size 26
@sumitmohite4908
@sumitmohite4908 3 жыл бұрын
What is curr = this .
@rajapanda832
@rajapanda832 4 жыл бұрын
In line number 31 you have already handled if the child is null. So, in line 34 it will never be null.
@ayyappahemanth7134
@ayyappahemanth7134 4 жыл бұрын
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
@KnowledgeCenter
@KnowledgeCenter 4 жыл бұрын
Added
@vamsimudaliar8643
@vamsimudaliar8643 4 жыл бұрын
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
@ayyappahemanth7134
@ayyappahemanth7134 4 жыл бұрын
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
@abhilashvadnala5865
@abhilashvadnala5865 4 жыл бұрын
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.
@praveen3123
@praveen3123 4 жыл бұрын
then there are people who doesn't want to learn any new programming language apart from the one they are comfortable with..
Stream of Characters | LeetCode 1032 | C++, Java, Python
26:25
Knowledge Center
Рет қаралды 4,9 М.
“Don’t stop the chances.”
00:44
ISSEI / いっせい
Рет қаралды 59 МЛН
99.9% IMPOSSIBLE
00:24
STORROR
Рет қаралды 30 МЛН
Каха и дочка
00:28
К-Media
Рет қаралды 3,3 МЛН
So Cute 🥰 who is better?
00:15
dednahype
Рет қаралды 19 МЛН
Trie Data Structure (EXPLAINED)
8:51
Lukas Vyhnalek
Рет қаралды 220 М.
Trie Data Structure Implementation (LeetCode)
11:50
AlgosWithMichael
Рет қаралды 73 М.
Design HashSet | LeetCode 705 | C++, Java, Python
28:27
Knowledge Center
Рет қаралды 19 М.
Vertical Order Traversal of a Binary Tree | LeetCode 987 | C++, Python
25:52
Top 7 Data Structures for Interviews Explained SIMPLY
13:02
Codebagel
Рет қаралды 239 М.
L1. Implement TRIE | INSERT | SEARCH | STARTSWITH
31:25
take U forward
Рет қаралды 331 М.
Should you learn C++?? | Prime Reacts
20:29
ThePrimeTime
Рет қаралды 406 М.
Design Twitter - Leetcode 355 - Python
22:47
NeetCode
Рет қаралды 93 М.
“Don’t stop the chances.”
00:44
ISSEI / いっせい
Рет қаралды 59 МЛН