Skip to content

Commit 7406384

Browse files
committed
89차 2번 문제풀이
1 parent be3b09b commit 7406384

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

live8/test89/문제2/백유진.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
n = int(input())
2+
3+
arr = []
4+
5+
for i in range(n):
6+
arr.append(int(input()))
7+
8+
arr.sort()
9+
10+
start = 0
11+
end = 0
12+
13+
max = float("-inf")
14+
15+
while end < n:
16+
if arr[end] - arr[start] > 4:
17+
start += 1
18+
else:
19+
if end - start + 1 > max:
20+
max = end - start + 1
21+
end += 1
22+
23+
24+
print(5-max)

0 commit comments

Comments
 (0)