[HackerRank][Python3] Max Min
2018. 7. 16. 01:00 |
프로그래밍/HackerRank
Problem :
https://www.hackerrank.com/challenges/angry-children/problem
My Solution :
#!/usr/bin/env python3 def maxMin(k, arr): arr.sort() m = 10**9 for i in range(len(arr)-k+1): m = min(m, arr[i+k-1] - arr[i]) return m n, k = int(input()), int(input()) arr = [] for _ in range(n): arr.append(int(input())) result = maxMin(k, arr) print(result)
'프로그래밍 > HackerRank' 카테고리의 다른 글
[HackerRank][Python3] Minimum Time Required (0) | 2018.07.17 |
---|---|
[HackerRank][Python3] Pairs (0) | 2018.07.17 |
[HackerRank][Python3] Hash Tables: Ice Cream Parlor (0) | 2018.07.16 |
[HackerRank][Python3] Triple sum (0) | 2018.07.16 |
[HackerRank][Python3] Greedy Florist (0) | 2018.07.16 |
[HackerRank][Python3] Luck Balance (0) | 2018.07.15 |
[HackerRank][Python3] Common Child (0) | 2018.07.15 |
[HackerRank][Python3] Sherlock and the Valid String (0) | 2018.07.15 |
최근에 달린 댓글 최근에 달린 댓글