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/
No comments:
Post a Comment