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
- Python
- Strings
- The Minion Game
- Discussions
The Minion Game
The Minion Game
Sort by
recency
|
1290 Discussions
|
Please Login in order to post a comment
I used below conditional logic and passed most, but not all test cases. Have no idea why. Any inputs? if string[i] == ("A" or "E" or "U" or "I" or "O"): ....
The table is actually misleading, it tries to count the occurence of each word in the whole string, making things way more complicated.
It will be much clearer to list all Stuart's word like this:
BANANA BANAN ... ... B
NANA NAN NA N ... ...
Which concludes a much simpler logic to code: For every word satisfies the condition, that word with last element removed will also satisfies the condition. And by iterating down the string, each word will occur exactly once.
Here is HackerRank The Minion Game in python problem solution - https://programmingoneonone.com/hackerrank-the-minion-game-solution-in-python.html