Skip to content

Commit 4496e8d

Browse files
authored
Update 217._contains_duplicate.md
1 parent 0f0e0b5 commit 4496e8d

File tree

1 file changed

+33
-6
lines changed

1 file changed

+33
-6
lines changed

docs/Leetcode_Solutions/217._contains_duplicate.md

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,40 @@
1-
### 217. Contains Duplicate
1+
# 217. Contains Duplicate
2+
**<font color=red>难度: 简单</font>**
23

3-
题目:
4-
<https://leetcode.com/problems/contains-duplicate/>
4+
## 刷题内容
55

6+
> 原题连接
67
7-
难度:
8+
* https://leetcode.com/problems/contains-duplicate/
89

9-
Easy
10+
> 内容描述
11+
12+
```
13+
14+
Given an array of integers, find if the array contains any duplicates.
15+
16+
Your function should return true if any value appears at least twice in the array, and it should return false if every element is distinct.
17+
18+
Example 1:
19+
20+
Input: [1,2,3,1]
21+
Output: true
22+
Example 2:
23+
24+
Input: [1,2,3,4]
25+
Output: false
26+
Example 3:
27+
28+
Input: [1,1,1,3,3,4,3,2,4,2]
29+
Output: true
30+
```
31+
32+
## 解题方案
33+
34+
> 思路 1
35+
36+
利用set怎么可以这么简单。。。。
1037

11-
怎么可以这么简单。。。。
1238

1339
```python
1440
class Solution(object):
@@ -21,6 +47,7 @@ class Solution(object):
2147
```
2248

2349

50+
> 思路 2
2451
2552
或者先 sort 也可以
2653

0 commit comments

Comments
 (0)