Skip to content

Instantly share code, notes, and snippets.

@restart916
Created June 19, 2019 21:38
Show Gist options
  • Save restart916/393c4c7440042d8961c964928e00367b to your computer and use it in GitHub Desktop.
Save restart916/393c4c7440042d8961c964928e00367b to your computer and use it in GitHub Desktop.
20190619_leetcode_771_JewelsandStones
/**
* @param {string} J
* @param {string} S
* @return {number}
*/
var numJewelsInStones = function(J, S) {
let count = 0
sMap = {}
for (let s of S) {
if (s in sMap) {
sMap[s]++;
} else {
sMap[s] = 1;
}
}
for (let j of J) {
if (j in sMap) {
count += sMap[j]
}
}
return count;
}
@graynun
Copy link

graynun commented Jun 20, 2019

호엥 이 풀이 보니까 제가 진짜 변태적으로 풀었다는 것은 잘 알겠네욬ㅋㅋㅋㅋㅋㅋㅋㅋ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment