Created
March 24, 2022 22:19
-
-
Save see-why/5435120874aecd06ab635efcc74c959c to your computer and use it in GitHub Desktop.
Hackerrank Game of thrones 1 challenge solution
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
# https://www.hackerrank.com/challenges/game-of-thrones/problem?isFullScreen=true | |
def gameOfThrones(s): | |
# Write your code here | |
dict = collections.Counter(s) | |
max_value = max(dict.values()) | |
if(max_value == 1): | |
return 'NO' | |
result = 'YES' | |
counter = 0 | |
for k, v in sorted(dict.items()): | |
if(v%2 == 1): | |
counter += 1 | |
if (counter >= 2): | |
result = 'NO' | |
break | |
return result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment