Package g0301_0400.s0383_ransom_note
Class Solution
-
- All Implemented Interfaces:
public final class Solution383 - Ransom Note.
Easy
Given two strings
ransomNoteandmagazine, returntrueifransomNotecan be constructed by using the letters frommagazineandfalseotherwise.Each letter in
magazinecan only be used once inransomNote.Example 1:
Input: ransomNote = "a", magazine = "b"
Output: false
Example 2:
Input: ransomNote = "aa", magazine = "ab"
Output: false
Example 3:
Input: ransomNote = "aa", magazine = "aab"
Output: true
Constraints:
<code>1 <= ransomNote.length, magazine.length <= 10<sup>5</sup></code>
ransomNoteandmagazineconsist of lowercase English letters.
-
-
Constructor Summary
Constructors Constructor Description Solution()
-
Method Summary
Modifier and Type Method Description final BooleancanConstruct(String ransomNote, String magazine)-
-
Method Detail
-
canConstruct
final Boolean canConstruct(String ransomNote, String magazine)
-
-
-
-