문제풀이/백준(Boj) 문제풀이

[백준][그리디 알고리즘] 11497. 통나무 건너뛰기 (파이썬/Python)

얄루몬 2022. 1. 31. 01:21

t = int(input())

for _ in range(t):
    n = int(input())
    tree = list(map(int,input().split()))
    tree.sort()
    answer = 0
    for i in range(2,n):
        answer = max(answer,abs(tree[i] - tree[i-2]))
    print(answer)