What's the time complexity of this code?
class Solution(object):
    def longestConsecutive(self, nums):
        if not nums:
            return 0
        lst = []
        nums.sort()
        for i in nums:
            if i not in lst:
                lst.append(i)
        p1 = 0 
        p2 = 0 
        maxSub = 1
        while p2 < len(lst)-1:
            if lst[p2 + 1] == lst[p2] + 1:
                p2 += 1
                maxSub = max(maxSub, p2-p1+1)
            else:
                p1 += 1
                p2 = p1 
        return maxSub
Comments (1)