Given an array of n size, the task is to find the longest subsequence such that difference between adjacents is one.
Input : arr[] = {10, 9, 4, 5, 4, 8, 6}
Output : 3
As longest subsequences with difference 1 are, "10, 9, 8",
"4, 5, 4" and "4, 5, 6"
Input : arr[] = {1, 2, 3, 2, 3, 7, 2, 1}
Output : 7
As longest consecutive sequence is "1, 2, 3, 2, 3, 2, 1"