771. Jewels and Stones Easy
1/**
2 * [771] Jewels and Stones
3 *
4 * You're given strings jewels representing the types of stones that are jewels, and stones representing the stones you have. Each character in stones is a type of stone you have. You want to know how many of the stones you have are also jewels.
5 * Letters are case sensitive, so "a" is considered a different type of stone from "A".
6 *
7 * Example 1:
8 * Input: jewels = "aA", stones = "aAAbbbb"
9 * Output: 3
10 * Example 2:
11 * Input: jewels = "z", stones = "ZZ"
12 * Output: 0
13 *
14 * Constraints:
15 *
16 * 1 <= jewels.length, stones.length <= 50
17 * jewels and stones consist of only English letters.
18 * All the characters of jewels are unique.
19 *
20 */
21pub struct Solution {}
22
23// problem: https://leetcode.com/problems/jewels-and-stones/
24// discuss: https://leetcode.com/problems/jewels-and-stones/discuss/?currentPage=1&orderBy=most_votes&query=
25
26// submission codes start here
27
28impl Solution {
29 pub fn num_jewels_in_stones(jewels: String, stones: String) -> i32 {
30 0
31 }
32}
33
34// submission codes end
35
36#[cfg(test)]
37mod tests {
38 use super::*;
39
40 #[test]
41 fn test_771() {
42 }
43}
44
Back
© 2025 bowen.ge All Rights Reserved.