You are viewing a single comment's thread. Return to all comments →
Python 3 solution:
def gameOfThrones(s): d = {} for i in s: d[i] = d.get(i, 0) + 1 return('YES' if sum(i % 2 for i in d.values()) < 2 else 'NO')
In a palindrome, only 1 character at most can appear an odd number of times.. If more than 1 character appears an odd number times, we return 'NO',
'NO'
Seems like cookies are disabled on this browser, please enable them to open this website
Game of Thrones - I
You are viewing a single comment's thread. Return to all comments →
Python 3 solution:
In a palindrome, only 1 character at most can appear an odd number of times.. If more than 1 character appears an odd number times, we return
'NO'
,