Files
leetcode/1512-number-of-good-pairs/1512-number-of-good-pairs.py
T

10 lines
280 B
Python

class Solution:
def numIdenticalPairs(self, nums: List[int]) -> int:
count = 0
for i in range(len(nums)):
for j in range(i + 1, len(nums)):
if nums[i] == nums[j]:
count += 1
return count