SHARE
TWEET

Untitled

a guest Jul 22nd, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. func numJewelsInStones(_ J: String, _ S: String) -> Int {
  2.     let jewels = Set(J)
  3.     var count = 0
  4.    
  5.     for stone in S {
  6.         if jewels.contains(stone) {
  7.             count += 1
  8.         }
  9.     }
  10.     return count
  11. }
  12.  
  13. let num = numJewelsInStones("aA", "aAAbbbb")
  14. print(num)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top