Problem Link: http://www.codechef.com/problems/BYTES3
Difficulty: Medium-Hard
Strategy: Recursion, DP, Number Theory
Explanation:
The initial solution to the problem is by solving through Recursion, and counting all possible combinations. But this wont be a feasible solution. Hence, you would be required to apply Dynamic Programming. But, if we observe clearly, the question just of finding all paths above the diagonal in a n*n grid. Starting from one corner and ending at the opposite corner. Applying 2 state DP would give us the solution. Then we could just observe carefully and get a simple formula for doing this. The answer is simply a catalan number, i.e Cat(n)=(1/(n+1))((2n) C (n)). Now we need to calculate Cat(n)%(10^9 +7). Be careful in coding this so as to ensure not to get a Time Limit Exceeded or Wrong Answer.