python o(n) with extra req: DOUBLES NUMS COUNTED!
like it? please, vote!\ndont like? please, commit suggestions for optimization\n    \n    def longestConsecutive(self, nums):\n        counter=0\n        max_=0
**like it? please, vote!**\n*dont like? please, commit suggestions for optimization*\n    \n    def longestConsecutive(self, nums):\n        counter=0\n        max_=0\n        d=defaultdict (lambda:0) \n        for t in nums:\n            d[t]+=1 \n\n        for i in d.keys():\n            counter=d[i]\n            k=1\n\t\t\tif d.get(i-1)==None:\n\t\t\t\twhile d.get(i+k):\n\t\t\t\t\tcounter+=d[i+k]\n\t\t\t\t\tk+=1\n                \n            if counter>max_:\n                max_=counter\n        \n\n        return max_
['Python3']