• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
October 23, 2023 |1.7K Views
PROBLEM OF THE DAY: 22/10/2023 | Number of paths
Description
Discussion

Welcome to the daily solving of our PROBLEM OF THE DAY with Siddhartha Hazra. We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of Matrix but will also help you build up problem-solving skills.

In this problem, we are given, the problem to count all the possible paths from top left to bottom right of an MxN matrix with the constraint that from each cell you can either move to right or down.

Return answer modulo 10^9+7.

Example :

Input:
M = 3 and N = 3
Output: 6

Explanation:
Let the given input 3*3 matrix be filled as such:
A B C
D E F
G H I
The possible paths which exists to reach 'I' from 'A' following above conditions are as follows:ABCFI, ABEHI, ADGHI, ADEFI, ADEHI, ABEFI

Give the problem a try before going through the video. All the best!!!

Problem Link: https://practice.geeksforgeeks.org/problems/number-of-paths0926/1

Solution Function Link: https://ide.geeksforgeeks.org/online-cpp-compiler/a24b17fc-9b4e-4762-8dca-6324207c6c21