mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-07 07:35:35 +08:00
Update 0383.赎金信.md
为 Java 语言版本的代码添加长度判断
This commit is contained in:
@ -117,6 +117,10 @@ Java:
|
||||
```Java
|
||||
class Solution {
|
||||
public boolean canConstruct(String ransomNote, String magazine) {
|
||||
// shortcut
|
||||
if (ransomNote.length() > magazine.length()) {
|
||||
return false;
|
||||
}
|
||||
// 定义一个哈希映射数组
|
||||
int[] record = new int[26];
|
||||
|
||||
|
Reference in New Issue
Block a user