aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorterminaldweller <devi@terminaldweller.com>2023-12-30 05:47:32 +0000
committerterminaldweller <devi@terminaldweller.com>2023-12-30 05:47:32 +0000
commit12837e86ec0ddac185cbb9c98d17f091a5f07862 (patch)
tree11b765b3887525e861da072e908f8fabfcff15fc
parent1578 (diff)
downloadleetcode-12837e86ec0ddac185cbb9c98d17f091a5f07862.tar.gz
leetcode-12837e86ec0ddac185cbb9c98d17f091a5f07862.zip
1897
-rwxr-xr-x1897/main.py28
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()