public class Solution {
public int NumJewelsInStones(string jewels, string stones) {
var list =
from stone in stones
where jewels.Any(jewel => stone == jewel)
select stone;
return list.Count();
}
}
Source: https://leetcode.com/problems/jewels-and-stones/
"Simplicity can't be bought later, it must be earned from the start" -- DB
Sunday, February 14, 2021
Leetcode Everyday: 771. Jewels and Stones. Easy
Labels:
leetcode
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment