Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func numJewelsInStones(J string, S string) int {
- isJewel := make(map[byte]bool, len(J))
- count := 0
- for j := range J {
- isJewel[J[j]] = true
- }
- for s := range S {
- if isJewel[S[s]] {
- count ++
- }
- }
- return count
- }
Add Comment
Please, Sign In to add comment