Last active
February 12, 2019 20:53
-
-
Save bcowell/2624f1dc57b4d7ce49ca5bc26ca4fe0b to your computer and use it in GitHub Desktop.
28/01/2019 - 771. Jewels and Stones [Easy] bcowell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let J = "aA", S = "aAAbbbb" | |
let X = "z", Y = "ZZ"; | |
const numJewelsInStones = (J, S) => { | |
return [...S].reduce((sum, s) => sum += J.includes(s), 0); | |
}; | |
console.log( numJewelsInStones(J, S) ); | |
console.log( numJewelsInStones(X, Y) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Solution for leetcode 771. Jewels and Stones