Longest Geometric Progression
Submissions: 563   Accuracy:

6.45%

  Difficulty: Easy   Marks: 2

Given a set of numbers, find the Length of the Longest Geometrix Progression (LLGP) in it. The common ratio of GP must be an integer.

Input:

 

The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. The first line of each test case contains an integer N denoting the size array A representing the set of numbers

The second line of each test case contains N space separated integers denoting elements of the array A[ ].

Output:

Print the length of the longest geometric progression for each test case in a new line.


Constraints:

1<= T <=100

1<= N <=1000

1<= A[ ] <=10000


Example:

Input:

6

5 7 15 10 20 29

Output:

3

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Sujnesh Mishra
Author: sujnesh


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.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.