aboutsummaryrefslogtreecommitdiff
path: root/challenge-194/deadmarshal/python/ch2.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-194/deadmarshal/python/ch2.py')
-rw-r--r--challenge-194/deadmarshal/python/ch2.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/challenge-194/deadmarshal/python/ch2.py b/challenge-194/deadmarshal/python/ch2.py
new file mode 100644
index 0000000000..5fe176c5cb
--- /dev/null
+++ b/challenge-194/deadmarshal/python/ch2.py
@@ -0,0 +1,11 @@
+from collections import Counter
+
+def frequency_equalizer(s):
+ arr = sorted(list(Counter(s).values()),reverse=True)
+ if arr[0] == arr[1]+1 and arr[-1] == arr[1]: return True
+ return False
+
+print(frequency_equalizer("abbc"))
+print(frequency_equalizer("xyzyyxz"))
+print(frequency_equalizer("xzxz"))
+