✔️ Python O(n) Solution | 98% Faster | Easy Solution | K-diff Pairs in an Array
\uD83D\uDD3C IF YOU FIND THIS POST HELPFUL PLEASE UPVOTE \uD83D\uDC4D\n\nVisit this blog to learn Python tips and techniques and to find a Leetcode solution wit
**\uD83D\uDD3C IF YOU FIND THIS POST HELPFUL PLEASE UPVOTE \uD83D\uDC4D**\n\nVisit this blog to learn Python tips and techniques and to find a Leetcode solution with an explanation: https://www.python-techs.com/\n\n**Solution:**\n```\nclass Solution:\n    def findPairs(self, nums: List[int], k: int) -> int:\n        cnt=0\n        c=Counter(nums)\n        \n        if k==0:\n            for key,v in c.items():\n                if v>1:\n                    cnt+=1\n        else:\n            for key,v in c.items():\n                if key+k in c:\n                    cnt+=1\n        return cnt\n```\n**Thank you for reading! \uD83D\uDE04 Comment if you have any questions or feedback.**\n
['Python', 'Python3']