Saturday, 8 February 2014

Topcoder problem took me whole day to solve! :(

This problem took me almost the entire day to solve, even when I peeked at the solution and read the editorial. Phew!!! Before I could further glorify my failure let me note down here what I learnt.
1) If you are going for a recursive solution always think in terms of recursion tree. What is going to be the input to the recursive function and what is going to be the output.
2) Finding expectation can be broken down as sum of conditional expectation.
3) Be cautious about the base case, what should you return so that recursive function gives right solution.
4) Use bitwise masking for configurations/subsets etc if applicable, constaraints give the hint.
5) Cry some more.


No comments:

Post a Comment