We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
publicstaticStringgameOfThrones(Strings){// Write your code hereint[]CHAR=newint[26];intoddCount=0;for(inti=0;i<s.length();i++){CHAR[s.charAt(i)-97]++;// ascii of a is 97}for(inti=0;i<26;i++){oddCount+=CHAR[i]%2;}if(s.length()%2==0&&oddCount==0)return"YES";if(s.length()%2!=0&&oddCount==1)return"YES";return"NO";}
Cookie support is required to access HackerRank
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 →
JAVA