Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution {
- public:
- int numJewelsInStones(string jewels, string stones) {
- int ans=0;
- for(int i=0;i<stones.length();i++)
- {
- if(jewels.find(stones[i])>=0 && jewels.find(stones[i])<jewels.length())
- {
- ans++;
- }
- }
- return ans;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment