Skip to content

Commit 5e40e17

Browse files
update post
1 parent 12566a7 commit 5e40e17

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

_posts/2024-05-07-leetcode-15.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,14 +271,15 @@ example input : [-4, -2, -2, -2, 0, 1, 2, 2, 2, 3, 3, 4, 4, 6, 6]
271271

272272
#### j가 아니라 i를 옮기는 코드
273273

274-
```
274+
```java
275275
while (j > i && nums[i] == nums[i - 1])
276276
i++;
277277
```
278278

279279
### TC, SC
280280

281-
모범답안도 동일하게 시간 복잡도는 O(n^2), 공간 복잡도는 O(n^2) 이다. 하지만 실제 동작은 20-30ms 로 끝나기 떄문에 약 33배 차이가 난다.
281+
모범답안도 동일하게 시간 복잡도는 O(n^2)이다. 시간 복잡도는 이전과 동일하지만 실제 동작은 20-30ms 로 끝나기 떄문에 약 33배 차이가 난다.
282+
공간 복잡도에서는 큰 의미가 있는데 결과값을 고려하지 않은 알고리즘 자체의 공간 복잡도는 O(1) 이다.
282283

283284
![best answer](/assets/images/2024-05-07-leetcode-15/best-answer.png)
284285

0 commit comments

Comments
 (0)