-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path217 Contains Duplicate.cs
More file actions
52 lines (44 loc) · 1.14 KB
/
217 Contains Duplicate.cs
File metadata and controls
52 lines (44 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//217. Contains Duplicate https://leetcode.cn/problems/contains-duplicate/ 5/25/2023 11:33 AM
/*using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _2441__Largest_Positive_Integer_That_Exists_With_Its_Negative
{
internal class _217_____Contains_Duplicate
{
}
}
*/
//using System.Collections;
//public class Solution// 2023/05/25 11:57
//{
// public bool ContainsDuplicate(int[] nums)
// {
// HashSet<int> visited = new HashSet<int>();
// int L = nums.Length;
// for (int i = 0; i < L; i++)
// {
// if (visited.Contains(nums[i])) return true;
// visited.Add(nums[i]);
// }
// return false;
// }
//}
//public class Solution
//{
// public bool ContainsDuplicate(int[] nums)
// {
// Dictionary<int, int> result = new Dictionary<int, int>();
// for (int i = 0; i < nums.Length; i++)
// {
// if (result.ContainsKey(nums[i]))
// {
// return true;
// }
// result.Add(nums[i], i);
// }
// return false;
// }
//}