From 8568ef12d2da5547cba19edd9b354b08f967ff88 Mon Sep 17 00:00:00 2001 From: Mahesh Dattatraya Babar <53929423+maheshdbabar9340@users.noreply.github.com> Date: Sat, 9 Oct 2021 18:41:07 +0530 Subject: [PATCH] Added Solution for The Minion Game (HackerRank). --- HackerRank The Minion Game Solution | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 HackerRank The Minion Game Solution diff --git a/HackerRank The Minion Game Solution b/HackerRank The Minion Game Solution new file mode 100644 index 0000000..6bc68d4 --- /dev/null +++ b/HackerRank The Minion Game Solution @@ -0,0 +1,11 @@ +def minion_game(s): + V = frozenset("AEIOU") + n = len(s) + ksc = sum(q for c, q in zip(s, range(n, 0, -1)) if c in V) + ssc = n * (n + 1) // 2 - ksc + if ksc > ssc: + print("Kevin {:d}".format(ksc)) + elif ssc > ksc: + print("Stuart {:d}".format(ssc)) + else: + print("Draw")