What went well
- I managed to prove that my solution to B is optimal.
- Proving that my B solution is optimal took close to an hour.
- I wasn't sure what to do with C. After expressing the sum as S and the xor as X, I first fell into a trap thinking that I can do it with one number, i.e. S + a = 2*(X ^ a). Nothing really came to mind. Then I thought about using two numbers, i.e. S + a + b = 2*(X ^ a ^ b), where I use a to get rid of S, i.e. make the bits of S be all 0s or all 1s. This led me to think about the lowest power of 2 greater than S, but nothing came to mind. I also never thought about using a to get rid of X, i.e. maybe set a = X, which then leads to a really nice solution S + X + b = 2*b, i.e. b = S + X.
- A is a 3 minute problem!
No comments:
Post a Comment