 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Count all possible paths from top left to bottom right of a mXn matrix in C++
In this tutorial, we will be discussing a program to find the number of possible paths from top left to bottom right of a mXn matrix.
For this we will be provided with a mXn matrix. Our task is to find all the possible paths from top left to bottom right of the given matrix.
Example
#include <iostream> using namespace std; //returning count of possible paths int count_paths(int m, int n){    if (m == 1 || n == 1)       return 1;    return count_paths(m - 1, n) + count_paths(m, n - 1); } int main(){    cout << count_paths(3, 3);    return 0; }  Output
6
Advertisements
 