// Example usageletarr1=[1,9,3,10,4,20,2]print("Longest consecutive subsequence length for arr1: \(longestConsecutiveSubsequence(arr:arr1))")
Output
Longest consecutive subsequence length for arr1: 4
// Example usageletarr2=[36,41,56,35,44,33,34,92,43,32,42]print("Longest consecutive subsequence length for arr2: \(longestConsecutiveSubsequence(arr:arr2))")
Output
Longest consecutive subsequence length for arr2: 5