Objective: Count all the paths from left top corner to right bottom corner in two dimensional array.
Input: Two Dimensional array
Output: No of paths.
Approach :
1. Recursive
Recursive solution to this problem is similar to Print All Paths from Top left to bottom right in Two Dimensional Array
But the Time complexity will be exponential because there will be many sub problems which will be solved again and again to get the final solution. read this : “Dynamic programming vs Recursion
2. Dynamic Programming (Better Solution)