You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given an array A of size N, the task is to find the longest subsequence such that difference between adjacents is one.
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 of array A.The second line of each test case contains N space separated integers denoting elements of the array A[ ].
Output:
For each testcase, in a new line, print the length of the longest subsequence such that difference between adjacents is one.