## Solutions
### Hash Table
```python
class Solution(object):
def numIdenticalPairs(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
num_dic = {}
good_pair_count = 0
for num in nums:
if num in num_dic:
good_pair_count += num_dic[num]
num_dic[num] += 1
else:
num_dic[num] = 1
return good_pair_count
```
- 自己想出了能计算一遍的 beta,不正确但是想到了用 hashtable 储存
- 看了一个 solution,发现 value 要储存出现次数,试着自己写了一下,比那个 solution 更简化一步解决了
#### Complexity Analysis
- Time complexity is On
- for loop the list = On
- hashmap insert and lookup is O1 (linear)
- Space complexity is On
- we need to store the length of nums in the worst case