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 0e5ffe5 commit a376b55Copy full SHA for a376b55
contains-duplicate/grapefruit13.ts
@@ -0,0 +1,16 @@
1
+/**
2
+ * @description nums 배열에서 중복 숫자 확인
3
+ * @param nums - 숫자 배열
4
+ * @returns boolean - 중복 숫자 여부
5
+ */
6
+const containsDuplicate = (nums: number[]) => {
7
+ const hasSeen = new Set<number>();
8
+
9
+ for (const num of nums) {
10
+ if (hasSeen.has(num)) {
11
+ return true;
12
+ }
13
+ hasSeen.add(num);
14
15
+ return false;
16
+};
0 commit comments