Please solve the programming task below using a self-contained code snippet in a markdown code block.

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.
 
Please complete the following python code precisely:
```python
class Solution:
    def numIdenticalPairs(self, nums: List[int]) -> int:
```