diff options
Diffstat (limited to '1897')
-rwxr-xr-x | 1897/main.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/1897/main.py b/1897/main.py new file mode 100755 index 0000000..17b268c --- /dev/null +++ b/1897/main.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python +import typing + + +class Solution: + def makeEqual(self, words: typing.List[str]) -> bool: + dicts: typing.Dict = {} + for word in words: + for c in word: + if c in dicts: + dicts[c] += 1 + else: + dicts[c] = 1 + + for k, v in dicts.items(): + if v % len(words) != 0: + return False + + return True + + +def main(): + solution = Solution() + print(solution.makeEqual(["abc", "aabc", "bc"])) + + +if __name__ == "__main__": + main() |