Grokking the Coding Interview: Patterns for Coding Questions
Ask Author
Back to course home

0% completed

Vote For New Content
Toni Dezman
Python solution using Counter

Toni Dezman

May 17, 2025

from collections import Counter class Solution: def numGoodPairs(self, nums): seen = Counter() res = 0 for num in nums: res += seen[num] seen[num] += 1 return res

0

0

Comments
Comments

On this page