Skip to content

Commit 003b675

Browse files
committed
docs: add space complexity explanation
1 parent c75f0f1 commit 003b675

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

โ€Žcontains-duplicate/taekwon-dev.javaโ€Ž

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ class Solution {
55
* - ์ค‘๋ณต ๊ฒ€์‚ฌ๋ฅผ ์œ„ํ•ด Set ์„ ํƒํ•œ ์ด์œ 
66
* - O(1) ์œผ๋กœ ํƒ์ƒ‰ ๊ฐ€๋Šฅ
77
* - ๋ฐ์ดํ„ฐ ์ˆœ์„œ ๋ณด์žฅ ํ•„์š” ์—†์Œ
8+
*
9+
* ๊ณต๊ฐ„ ๋ณต์žก๋„: O(N)
10+
* - ์ตœ์•…์˜ ๊ฒฝ์šฐ ์ฃผ์–ด์ง„ ๋ฐฐ์—ด์˜ ๋ชจ๋“  ์›์†Œ๊ฐ€ ์ž๋ฃŒ๊ตฌ์กฐ์— ์ €์žฅ๋˜๋ฏ€๋กœ O(N)
811
*/
912
public boolean containsDuplicate(int[] nums) {
1013
Set<Integer> set = new HashSet<>();

0 commit comments

Comments
ย (0)