Given an array of positive integers. Finding the length of the longest sub-sequence such that elements in the subsequence are consecutive integers,
The consecutive numbers can be in any order.
Example:
Input: {2,6,1,9,4,5,3}
Output: 6
Explanation:
The consecutive numbers here
are 1, 2, 3, 4, 5, 6.
These 6 numbers form the longest consecutive subsequence.
Longest consecutive subsequence in array
Given an array of positive integers. Finding the length of the longest sub-sequence such that elements in the subsequence are consecutive integers, The consecutive numbers can be in any order.
Example:
Input: {2,6,1,9,4,5,3} Output: 6 Explanation: The consecutive numbers here are 1, 2, 3, 4, 5, 6. These 6 numbers form the longest consecutive subsequence.