Number of Good Pairs LeetCode solution in Java

1
class Solution {
2
public int numIdenticalPairs(int[] nums) {
3
int len = nums.length;
4
int counter = 0;
5
for (int i = 0; i < len; i++) {
6
for (int j = i + 1; j < len; j++) {
7
if (nums[i] == nums[j]) {
8
counter++;
9
}
10
}
11
}
12
return counter;
13
}
14
}

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0