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.
- Prepare
- Algorithms
- Strings
- Game of Thrones - I
- Discussions
Game of Thrones - I
Game of Thrones - I
Sort by
recency
|
1077 Discussions
|
Please Login in order to post a comment
The odd even check is actually unnecessary I've just figured. You can skip that part but the logic is pretty much the same. Java:
Here is my c++ solution : explanation here : https://youtu.be/yhSaL48IHds
solution 1 :
solution 2 :
Here it is Java Code:
import java.util.*;
class Solution{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); String s = sc.nextLine(); System.out.println(got(s));
}
https://github.com/Achintha444/problem-solving-hackerrank-js/blob/main/98-game-of-thrones.js
Answer in javascript
One liner.
def gameOfThrones(s):
return "NO" if sum([1 for i in [s.count(i) for i in set(s)] if i % 2 != 0]) > 1 else "YES"