My issue
second test is not working y is this so?
is there any edge case i am missing?
t = int(input())
while t > 0:
a, b, c = map(int, input().split())
arr = [0, a, b]
for i in range(3, c+2):
arr.append(arr[i-1] + arr[i-2] - arr[i-3])
arr.sort()
print(arr[c-1])
t -= 1
My code
t = int(input())
while t > 0:
a, b, c = map(int, input().split())
arr = [0, a, b]
for i in range(3, c+2):
arr.append(arr[i-1] + arr[i-2] - arr[i-3])
arr.sort()
print(arr[c-1])
t -= 1
Problem Link: Sequence Search Practice Coding Problem