Python3 | A very simple solution using HEAP DS
Introduction\nFor this problem, you may have seen a lot of the solutions use streak counting system. But it is just another two pointer method \uD83D\uDE12. \n\
#### Introduction\nFor this problem, you may have seen a lot of the solutions use streak counting system. But it is just another two pointer method \uD83D\uDE12. \n\nToday, I will show you how to solve this problem using a heap data structure (specifically min heap) \uD83D\uDE03.\nIf you are new to heap ds, I suggest you to see these source:\n- https://leetcode.com/explore/learn/card/heap/643/heap/4018/ (This intro card is more than enough to understand).\n- https://docs.python.org/3/library/heapq.html (The python in-built lib for heaps)\n\n#### Explanation\n1. We remove the duplicates since we are only focussing on the consecutive elements rather than a duplicate.\n\t- `a = list(set(a))`\n2. Then we heapify the array with the unique elements.\n\t- `heapq.heapify(a)` - this will turn the array into min-heap\n3. Then we traverse the heap.\n\t- For 1 iteration:\n\t\t1. pop the minimum value.\n\t\t2. Increment temp answer by 1\n\t\t2. Check if `peek_value != popped val + 1` (we just peek the first element of heap)\n\t\t3. If so, we check the max of the best value and the temp value and reset the temp.\n4. The best value is the answer.\n\n\n#### Solution\n```\n        a, best, temp = list(set(a)), 0, 0\n        heapq.heapify(a)\n\t\t\n        while a:\n            pop_val = heapq.heappop(a)\n            t += 1\n            if a == [] or a[0] != pop_val + 1:\n                res = max(t, res)\n                t = 0\n        return res\n```\n\nPlease do **Upvote** if you like the solution.
['Heap (Priority Queue)', 'Python', 'Python3']