Logo
IconChallenge
Icon
IconProblem
IconSolutions
IconSubmissions

Number of Good Pairs

XPChallenge Points: 10
levelLevel: Easy

Given an array of integers nums, return the number of good pairs.
A pair (i, j) is called good if:
• nums[i] == nums[j], and
• i < j.

Example 1:

Input: nums = [1, 2, 3, 1, 1, 3]

Output: 4

Example 2:

Input: nums = [1, 1, 1, 1]

Output: 6

to Continue
like
dislike

Accepted:

Submission:

IconReport an issue
Icon
IconCode
IconYou need toto run or submitYou need toto run or submit
IconTest Case
IconTest Result