Skip to content

Commit e141a44

Browse files
author
Jaskaran Singh
authored
Create jewels_and_stones.js
1 parent cd1db4e commit e141a44

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

jewels_and_stones.js

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

0 commit comments

Comments
 (0)