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.
We can apply one final small optimisation in this problem, as we know that the sum of Stuart and Kevin's points for a given string is constant (equal to ((n + 1)n/2), where (n) is the length of the string). Therefore, we can skip keeping track of, for example, Stuart's points and, at the end, subtract Kevin's points from the known total.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
The Minion Game
You are viewing a single comment's thread. Return to all comments →
We can apply one final small optimisation in this problem, as we know that the sum of Stuart and Kevin's points for a given string is constant (equal to ((n + 1)n/2), where (n) is the length of the string). Therefore, we can skip keeping track of, for example, Stuart's points and, at the end, subtract Kevin's points from the known total.