LeetCode Word Search Solution Explained - Java

preview_player
Показать описание


Preparing For Your Coding Interviews? Use These Resources
————————————————————

Other Social Media
----------------------------------------------

Show Support
------------------------------------------------------------------------------

#coding #programming #softwareengineering
Рекомендации по теме
Комментарии
Автор

You fail to explain a very important part of this problem, that is *Why it's not the same as Number of Islands*, and the reason is that you backtrack in line 41:
visited[i][j] = false; That part should be carefully explained.

jlecampana
Автор

The most relatable programmer lol, thanks for making these videos man

luisgualpa
Автор

It seems that you are not fully understand this problem and just recite the CODE!

jingli
Автор

Thanks nick! I just encountered the exact same problem with the “aaa” test case. Unlike you I tried to make a node graph with edges but now that I see your solution i see that I was trying too hard lol. Super helpful thanks man

danrussell_official
Автор

Why do we make the visited[i][j] = false again ?

rohit-ldfc
Автор

The test cases for the problem might have changed since the recording of this video. But would this solution work for the test case:
Board: ABCE
SFES
ADEE
and word: ABCEFSADEESE
??

omarbousbia
Автор

you can just flag the visited element instead of maintaining one more array.

vishwanathpatil
Автор

Can someone please explain to me how that if statement that calls recursively works? I understand how it is called but it does not connect how it will return true for me. Thank you.

charlesbickham
Автор

Thank you, this is so helpful! I love how you explain the thought process

yoojinlee
Автор

How is this similar to number of islands? The initial for loop is, I suppose, but the algorithm used is completely different. Islands used DFS and this is backtracking

ravijain
Автор

hey nick i hope you keep doing what you do.

shreyrawat
Автор

stuck at exactly same place and then i watched this video

mohanmanu
Автор

Thank Nick, I like your idea to create a visited boolean array. Besides, you speed up the algorithm by searching only when the first character in word matches current position in board. ❤

linhnguyenduc
Автор

thanks a lot. was stuck at this problem.

JOBFERNANDEZBCD
Автор

Thank you Nick, this is very helpful.

yuewu
Автор

Thank you so much, it is very helpful!

luciay
Автор

your explanation is not very good my guy.

Fresh-shgc