Package g0301_0400.s0383_ransom_note
Class Solution
java.lang.Object
g0301_0400.s0383_ransom_note.Solution
383 - Ransom Note.<p>Easy</p>
<p>Given two stings <code>ransomNote</code> and <code>magazine</code>, return <code>true</code> if <code>ransomNote</code> can be constructed from <code>magazine</code> and <code>false</code> otherwise.</p>
<p>Each letter in <code>magazine</code> can only be used once in <code>ransomNote</code>.</p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> ransomNote = “a”, magazine = “b”</p>
<p><strong>Output:</strong> false</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> ransomNote = “aa”, magazine = “ab”</p>
<p><strong>Output:</strong> false</p>
<p><strong>Example 3:</strong></p>
<p><strong>Input:</strong> ransomNote = “aa”, magazine = “aab”</p>
<p><strong>Output:</strong> true</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 <= ransomNote.length, magazine.length <= 10<sup>5</sup></code></li>
<li><code>ransomNote</code> and <code>magazine</code> consist of lowercase English letters.</li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
canConstruct
-