-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSolution.java
More file actions
29 lines (25 loc) · 781 Bytes
/
Solution.java
File metadata and controls
29 lines (25 loc) · 781 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
class Solution {
public boolean exist(char[][] board, String word) {
char[] words = new char[word.length()];
for (int t = 0; t < word.length(); t++) {
words[t] = word.charAt(t);
}
for (int i = 0; i < board.length; i++) {
for (int j = 0; j < board[i].length; j++) {
for (int k = 0; k < words.length; k++) {
if (board[i][j] == words[k]) {
words[k] = '0';
break;
}
}
}
}
for (int l = 0; l < words.length; l++) {
System.out.print(words[l]);
if ((words[l] != '0')) {
return false;
}
}
return true;
}
}