🗒️ 파이썬 코드 풀이T = int(input())for tc in range(1,T+1): N,K = map(int,input().split()) lst = list(map(int,input().split())) lst.sort() candle_mn = lst[K-1]-lst[0] for i in range(1,len(lst)-K+1): tmp = lst[i:i+K] candle_mn = min(candle_mn,(tmp[K-1]-tmp[0])) print(f"#{tc} {candle_mn}") 1. 투포인터 알고리즘 방식으로 진행한다. 2. 우선 lst를 오름차순으로 정렬해준다. 3. candle_mn (최소값)을 초기값으로 설정한다. 4. ..