LeetCode-771 Jewels and Stones Solution with Java

1. Description:

Notes:

2. Examples: 

3.Solutions:

1 public int numJewelsInStones(String J, String S) {
2         int num = 0;
3         for (int i = 0; i < S.length(); i++) {
4             if (J.contains(S.charAt(i) + ""))
5                 num++;
6         }
7         return num;
8     }

猜你喜欢

转载自www.cnblogs.com/sheepcore/p/12394816.html
今日推荐