Skip to content

Commit 760d2f7

Browse files
author
Jaskaran Singh
authored
Create number_good_pairs.js
1 parent a3a80ac commit 760d2f7

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

number_good_pairs.js

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

0 commit comments

Comments
 (0)