Given an array of integers, the task is to check whether it's an arithmetic progression, geometric progression or fibonacci series, and need to print the next number in the series or -99999 if the given numbers does not follow any of the above series. The fibonacci series need not start with 0. A valid fibonacci series could be 8,9,17
NOTE: In case of clash, following precedence shold be followed: AP>GP>FIBO
The First line of the input contains a single interger T denoting the number of testcases. Then T test cases follow. Each test cases consists of two lines. First tline of each test case contains an interger N denoting the no. of integers in an array. The second line of each test case contains N integers denoting the array elements.
Corresponding to each test case, print the desired output modulo 10^9+7 in a new line.
NOTE: In case of floating point answer , the answer should be next greater integer.
1 2 3
1 3 9 27
2 3 5 8
2 5 6
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.