mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-05 00:25:22 +08:00
14 lines
211 B
Go
14 lines
211 B
Go
package leetcode
|
|
|
|
func numIdenticalPairs(nums []int) int {
|
|
total := 0
|
|
for x := 0; x < len(nums); x++ {
|
|
for y := x + 1; y < len(nums); y++ {
|
|
if nums[x] == nums[y] {
|
|
total++
|
|
}
|
|
}
|
|
}
|
|
return total
|
|
}
|