No video

WORD SEARCH | LEETCODE 79 | PYTHON DFS SOLUTION

  Рет қаралды 3,396

Cracking FAANG

Cracking FAANG

Күн бұрын

In this video we are solving a popular Amazon interview question: Word Search.
This is another search based question in a matrix except this time we are using DFS instead of the BFS that usually comes up. We have to be a bit smart with some postorder traversals here because we can mess up future DFS searches if we don't undo modifications of our original input grid.

Пікірлер: 9
@rohithamaz8767
@rohithamaz8767 Жыл бұрын
You really did a fantastic job … easiest & clear explanation… that’s awesome … I prefer recursion approach ..
@m.y.7230
@m.y.7230 Ай бұрын
very good explanation thanks
@dnm9931
@dnm9931 7 ай бұрын
You’re really good at explaining things! Please make more videos! You just gained a sub!
@ebenezeracquah478
@ebenezeracquah478 Жыл бұрын
Thanks for the video explanation.
@CreativeMining413
@CreativeMining413 11 ай бұрын
Is there a way we can use memoization to optimize this even further or it wouldn't make a difference? Great vid btw
@subee128
@subee128 7 ай бұрын
Thanks
@spoiltchild6517
@spoiltchild6517 Жыл бұрын
Facing "Time Limit Exceeded" error with same solution
@crackfaang
@crackfaang Жыл бұрын
Double check your DFS function for accidentally getting caught in an infinite loop. Otherwise if the code is the same I have noticed that for extremely popular questions so many people have answered it that the cutoff times for the code judge have become skewed and solutions that are valid solutions will now TLE.
@spoiltchild6517
@spoiltchild6517 Жыл бұрын
@@crackfaang I found the solution by adding the following code at beginning: # To prevent TLE,reverse the word, if frequency of the first letter is more than the last letter's board_count = defaultdict(int,sum(map(Counter,board),Counter())) if board_count[word[0]] > board_count[word[-1]]: word = word[::-1]
WORD LADDER | LEETCODE # 127 | PYTHON BFS SOLUTION
23:17
Cracking FAANG
Рет қаралды 1,4 М.
Идеально повторил? Хотите вторую часть?
00:13
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 18 МЛН
7 Days Stranded In A Cave
17:59
MrBeast
Рет қаралды 91 МЛН
Schoolboy Runaway в реальной жизни🤣@onLI_gAmeS
00:31
МишАня
Рет қаралды 3,6 МЛН
Word Search - Leetcode 79 - Recursive Backtracking (Python)
12:24
LeetCode Word Search Solution Explained - Java
12:08
Nick White
Рет қаралды 46 М.
WORD BREAK II | LEETCODE # 140 | PYTHON DFS SOLUTION
21:20
Cracking FAANG
Рет қаралды 5 М.
Word Search
8:46
Kevin Naughton Jr.
Рет қаралды 139 М.
I solved 541 Leetcode problems. But you need only 150.
7:42
Sahil & Sarra
Рет қаралды 2,3 МЛН
Идеально повторил? Хотите вторую часть?
00:13
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 18 МЛН