[LeetCode] 1512. Number of Good Pairs
Python
class Solution:
def numIdenticalPairs(self, nums: List[int]) -> int:
answer = 0
for i in range(len(nums)):
for j in range(i + 1, len(nums)):
if nums[i] == nums[j] and i < j:
answer += 1
return answer
댓글남기기