We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 139a4db commit 09835e7Copy full SHA for 09835e7
problems/0383.赎金信.md
@@ -214,6 +214,19 @@ class Solution:
214
return all(ransomNote.count(c) <= magazine.count(c) for c in set(ransomNote))
215
```
216
217
+(版本六)使用count(简单易懂)
218
+
219
+```python3
220
+class Solution:
221
+ def canConstruct(self, ransomNote: str, magazine: str) -> bool:
222
+ for char in ransomNote:
223
+ if char in magazine and ransomNote.count(char) <= magazine.count(char):
224
+ continue
225
+ else:
226
+ return False
227
+ return True
228
+```
229
230
### Go:
231
232
```go
0 commit comments