Skip to content

Commit 298c841

Browse files
chore: 시간,공간복잡도 추가
1 parent fdf3660 commit 298c841

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

word-search/grapefruitgreentealoe.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,17 @@ function backTracking(startPoint,board,word,check){
5959

6060
}
6161
return dfs(...startPoint,0)
62-
}
62+
}
63+
64+
/*
65+
시간 복잡도: O(m × n × 3^{L-1})
66+
- m × n: 시작점 후보 개수
67+
- 3^{L-1}: 첫 번째 이후로는 3방향으로만 뻗어나가는 경우의 수
68+
69+
70+
공간 복잡도: O(m × n)
71+
- 방문 체크 배열: O(m × n)
72+
- 재귀 호출 스택: 최악의 경우 단어 길이 L까지 깊어질 수 있으므로 O(L)
73+
74+
여기서 m, n은 보드 크기, L은 단어 길이
75+
*/

0 commit comments

Comments
 (0)