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.
if you really want to understand, the result is a difference between number A which is sum of negative powers of 2 and it's positive "inverse" which, since it starts with 2^1 is 2^(n+1) - 2 - A so it's Always 2^(n+1) - 2 - 2*A or 2*(2^n - 1 - A) so 2^n-1 is your only hope if you are P2
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Powers Game
You are viewing a single comment's thread. Return to all comments →
if you really want to understand, the result is a difference between number A which is sum of negative powers of 2 and it's positive "inverse" which, since it starts with 2^1 is 2^(n+1) - 2 - A so it's Always 2^(n+1) - 2 - 2*A or 2*(2^n - 1 - A) so 2^n-1 is your only hope if you are P2