Skip to content

Commit 232f11a

Browse files
committedSep 6, 2024·
word search 공간복잡도 업데이트
1 parent c49237b commit 232f11a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎word-search/jaejeong.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public boolean exist(char[][] board, String word) {
77
// 상하좌우 방문 여부 체크하면서 DFS 탐색
88
// index 기준으로 word와 비교하면서 같을 때만 추가 탐색
99
// 시간복잡도: O(M * N * 4^L) > M: board 행, N: board 열, 4: 상하좌우 4방향, L: word의 길이
10-
// 공간복잡도: O(1) > 별도 메모리 할당하지 않음
10+
// 공간복잡도: O(L) > word의 길이
1111
for (int i = 0; i < board.length; i++) {
1212
for (int j = 0; j < board[0].length; j++) {
1313
if (dfs(board, i, j, word, 0)) {

0 commit comments

Comments
 (0)
Please sign in to comment.