Back to course home
0% completed
Vote For New Content
Python Solution very fast very simple
Roman Pisani
Nov 22, 2024
def numGoodPairs(self, nums): pair_count = 0 seen_nums = {} for num in nums: if num not in seen_nums: seen_nums[num] = 1 else: pair_count += seen_nums[num] seen_nums[num] += 1 return pair_count
2
0
Comments
Comments
On this page