383. Ransom Note Easy
1/**
2 * [383] Ransom Note
3 *
4 * Given two strings ransomNote and magazine, return true if ransomNote can be constructed by using the letters from magazine and false otherwise.
5 * Each letter in magazine can only be used once in ransomNote.
6 *
7 * Example 1:
8 * Input: ransomNote = "a", magazine = "b"
9 * Output: false
10 * Example 2:
11 * Input: ransomNote = "aa", magazine = "ab"
12 * Output: false
13 * Example 3:
14 * Input: ransomNote = "aa", magazine = "aab"
15 * Output: true
16 *
17 * Constraints:
18 *
19 * 1 <= ransomNote.length, magazine.length <= 10^5
20 * ransomNote and magazine consist of lowercase English letters.
21 *
22 */
23pub struct Solution {}
24
25// problem: https://leetcode.com/problems/ransom-note/
26// discuss: https://leetcode.com/problems/ransom-note/discuss/?currentPage=1&orderBy=most_votes&query=
27
28// submission codes start here
29
30impl Solution {
31 pub fn can_construct(ransom_note: String, magazine: String) -> bool {
32 false
33 }
34}
35
36// submission codes end
37
38#[cfg(test)]
39mod tests {
40 use super::*;
41
42 #[test]
43 fn test_383() {
44 }
45}
46
Back
© 2025 bowen.ge All Rights Reserved.