From 12837e86ec0ddac185cbb9c98d17f091a5f07862 Mon Sep 17 00:00:00 2001 From: terminaldweller Date: Sat, 30 Dec 2023 00:47:32 -0500 Subject: 1897 --- 1897/main.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 1897/main.py 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() -- cgit v1.2.3