A Knowledge Base

This blog site is dedicated for articles on problem solving using C, C++, data structures, algorithms. Besides this few technical articles are also presented.

Mar 16, 2022

number of paths in a matrix from top left to bottom right

#include using namespace std; 

int numPathsInMatrix(int m, int n) 
{
 if(m==1 || n==1) return 1; 

return numPathsInMatrix(m-1, n) + numPathsInMatrix(m, n-1); 
}

 int main() { 
// your code goes here cout << numPathsInMatrix(4,4); 
return 0; 
}
Posted by Swetank at 10:35 AM

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Total Pageviews

Search This Blog

Blog Archive

  • ▼  2022 (30)
    • ►  May (1)
      • ►  25 May (1)
    • ►  April (3)
      • ►  08 Apr (1)
      • ►  07 Apr (1)
      • ►  03 Apr (1)
    • ▼  March (26)
      • ►  19 Mar (2)
      • ►  18 Mar (1)
      • ►  17 Mar (2)
      • ▼  16 Mar (2)
        • Find pair of a given sum in an array
        • number of paths in a matrix from top left to botto...
      • ►  15 Mar (1)
      • ►  12 Mar (2)
      • ►  10 Mar (1)
      • ►  09 Mar (1)
      • ►  08 Mar (3)
      • ►  07 Mar (8)
      • ►  04 Mar (1)
      • ►  02 Mar (1)
      • ►  01 Mar (1)
  • ►  2017 (10)
    • ►  June (10)
      • ►  26 Jun (2)
      • ►  25 Jun (4)
      • ►  24 Jun (1)
      • ►  23 Jun (1)
      • ►  07 Jun (1)
      • ►  02 Jun (1)
  • ►  2016 (1)
    • ►  July (1)
      • ►  12 Jul (1)
  • ►  2011 (31)
    • ►  May (1)
      • ►  04 May (1)
    • ►  April (29)
      • ►  20 Apr (11)
      • ►  19 Apr (18)
    • ►  February (1)
      • ►  11 Feb (1)

About Me

Swetank
View my complete profile

My Blog List

  • Curiosity of Technology
    Few Strategy Mistakes Companies Make
    12 years ago

Labels

TRIE (1) algorithm (19) array (5) data structure (16) dictionary (1) heapsort (1) inorder (1) kth smallest (1) linked list (3) matrix (1) maximum length of spaces (1) maximum sum sub array (1) mergesort (1) pattern search (3) quicksort (2) random numbers (1) remove duplicates (1) searching (1) sorted insert (1) spiral print (1) string (3) substring (1) traversal (1) word search (1)
Simple theme. Powered by Blogger.