My issue
Time limit exceeded
My code
t = int(input())
for _ in range(t):
n = int(input())
G = list(map(int, input().split()))
# initialise a counter to store max goal difference
max_diff = 0
i = 0
while i < n:
# For each possible i, j - find the max goal difference possible
j = i + 1
while j < n:
if G[j] - G[i] > max_diff:
max_diff = G[j] - G[i]
j = j + 1
i = i + 1
if max_diff >= 1:
print(max_diff)
else:
print('UNFIT')
Learning course: Kalasalingam Academy of Research and Education
Problem Link: CodeChef: Practical coding for everyone