For this Question: Given an unsorted array of integers, find the length of the longest consecutive elements sequence.

A consecutive set of integers is a consecutive elements sequence.

See sample for better understandingFirst line contains integer N number of elements of the array. Next line contains N space separated integers which are elements of array.
Constraints
1<= N <=100000
1<= A[i] <=100000Output the longest consecutive sequence in the array.Sample Input
7
100 4 200 1 3 2 2

Sample Output
4

Explanation
The longest consecutive elements sequence is [1, 2, 3, 4]. Therefore its length is 4., I have written this Solution Code: N = int(input())
A = [int(x) for x in input().split()]

numSet = set(A)
longest = 0
        
for n in A:
    if (n - 1) not in numSet:
        length = 0
        while (n + length) in numSet:
            length += 1
        longest = max(length, longest)
print(longest), In this Programming Language: Python, Now tell me if this Code is compilable or not?