Skip to content

Commit 6407765

Browse files
authored
Update Number of Good Pairs.java
1 parent c7f0398 commit 6407765

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Easy/Number of Good Pairs.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
class Solution {
2-
public int numIdenticalPairs(int[] nums) {
3-
Map<Integer, Integer> map = new HashMap<>();
4-
int count = 0;
5-
for (int num : nums) {
6-
count += map.getOrDefault(num, 0);
7-
map.put(num, map.getOrDefault(num, 0) + 1);
2+
public int numIdenticalPairs(int[] nums) {
3+
Map<Integer, Integer> map = new HashMap<>();
4+
int count = 0;
5+
for (int num : nums) {
6+
count += map.getOrDefault(num, 0);
7+
map.put(num, map.getOrDefault(num, 0) + 1);
8+
}
9+
return count;
810
}
9-
return count;
10-
}
1111
}

0 commit comments

Comments
 (0)