File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -120,8 +120,9 @@ Found match with word, return `True`.
120
120
``` java
121
121
public class LC79WordSearch {
122
122
public boolean exist (char [][] board , String word ) {
123
- if (board == null || board. length == 0 || board[0 ]. length == 0
124
- || word == null || word. length() == 0 ) return true ;
123
+ if (board == null || word == null ) return false ;
124
+ if (word. length() == 0 ) return true ;
125
+ if (board. length == 0 ) return false ;
125
126
int rows = board. length;
126
127
int cols = board[0 ]. length;
127
128
for (int r = 0 ; r < rows; r++ ) {
@@ -239,4 +240,4 @@ var exist = function(board, word) {
239
240
```
240
241
241
242
## References
242
- 1 . [ Backtracking Wiki] ( https://www.wikiwand.com/en/Backtracking )
243
+ 1 . [ Backtracking Wiki] ( https://www.wikiwand.com/en/Backtracking )
You can’t perform that action at this time.
0 commit comments