Skip to content

Commit caacc38

Browse files
committed
Create 1512-number-of-good-pairs.js
1 parent 704285e commit caacc38

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* @param {number[]} nums
3+
* @return {number}
4+
*/
5+
var numIdenticalPairs = function (nums) {
6+
let result = 0;
7+
for (let i = 0; i < nums.length; i++) {
8+
for (let j = i + 1; j < nums.length; j++) {
9+
if (nums[i] == nums[j]) {
10+
result++;
11+
}
12+
}
13+
}
14+
return result;
15+
};

0 commit comments

Comments
 (0)