The Minion Game

  • + 1 comment

    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.