We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f757103 commit c49237bCopy full SHA for c49237b
word-search/jaejeong.java
@@ -6,7 +6,7 @@ class SolutionWordSearch {
6
public boolean exist(char[][] board, String word) {
7
// 상하좌우 방문 여부 체크하면서 DFS 탐색
8
// index 기준으로 word와 비교하면서 같을 때만 추가 탐색
9
- // 시간복잡도: O(N) > 방문 여부 체크하면서 기방문한 곳은 탐색하지 않기 때문
+ // 시간복잡도: O(M * N * 4^L) > M: board 행, N: board 열, 4: 상하좌우 4방향, L: word의 길이
10
// 공간복잡도: O(1) > 별도 메모리 할당하지 않음
11
for (int i = 0; i < board.length; i++) {
12
for (int j = 0; j < board[0].length; j++) {
0 commit comments