The Minion Game

Sort by

recency

|

1268 Discussions

|

  • + 0 comments
    def minion_game(string):
        l = len(string)
        s,k = 0,0
        for i in range(l):
            if string[i] in "AEIOU":
                k+=l-i
            else:
                s+=l-i
        #print(*("Stuart",s) if s>k else ("Kevin",k) if k>s else ("Draw",))
        print(f"Stuart {s}" if s>k else f"Kevin {k}" if k>s else "Draw")
        
                    
    
    if __name__ == '__main__':
        s = input()
        minion_game(s)
    
  • + 0 comments

    i got the same got from chatgpt as below , after trying this for hour. I generated all possible substring from string , number of occurance of sub in man string , then count , took me an hour , then gpt said this is not that kind of problem :( . and it gave exact code . wasted 1.5 hours :(

  • + 0 comments
    def minion_game(string:str):
        VOWELS = ['A','E','I','O','U']
        n=len(string)
        k_score, s_score = 0,0
        
        for i in range(n):
            if string[i] in VOWELS:
                k_score += (n-i)
            else:
                s_score += (n-i)
    
        if k_score > s_score:
            print(f"Kevin {k_score}")
        elif k_score < s_score:
            print(f"Stuart {s_score}")
        else:
            print("Draw")
    
    if __name__ == '__main__':
        s = input()
        minion_game(s)
    
  • + 0 comments

    I love how it challenges players to think strategically about the substrings they create. Kevin's advantage lies in finding those vowel-starting gems, while Stuart gets to maximize consonant-starting substrings. fairplay 24 login

  • + 1 comment

    This is pretty straightforward because we just need to return the total scores (counts), and not the actual breakup of scores per substring. I am trying to shorten my code. But as of now, this is it.

    def minion_game(string:str):
        VOWELS = ['A','E','I','O','U']
        n=len(string)
        k_score, s_score = 0,0
        
        for i in range(n):
            if string[i] in VOWELS:
                k_score += (n-i)
            else:
                s_score += (n-i)
    
        if k_score > s_score:
            print(f"Kevin {k_score}")
        elif k_score < s_score:
            print(f"Stuart {s_score}")
        else:
            print("Draw")