Created
January 5, 2021 07:23
-
-
Save slapec/4ef089873e742109482e663df4538c93 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import collections | |
def scramble(word, chars): | |
word_char_count = collections.Counter(word) | |
chars_char_count = collections.Counter(chars) | |
chars_char_count.subtract(word_char_count) | |
return all(chars_char_count[word_char] >= 0 for word_char in word_char_count.keys()) | |
print(scramble('door', 'abcdeooor')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment