Geeksforgeeks

Error

×

Leaderboard

Showing:

Handle | Score |
---|---|

@Ibrahim Nash | 5761 |

@blackshadows | 5701 |

@akhayrutdinov | 5111 |

@mb1973 | 4989 |

@Quandray | 4944 |

@saiujwal13083 | 4506 |

@sanjay05 | 3762 |

@marius_valentin_dragoi | 3516 |

@sushant_a | 3459 |

@verma_ji | 3341 |

@KshamaGupta | 3318 |

Complete Leaderboard | |

Handle | Score |

@aroranayan999 | 938 |

@bt8816103042 | 739 |

@SHOAIBVIJAPURE | 428 |

@codeantik | 412 |

@SherlockHolmes3 | 407 |

@neverevergiveup | 348 |

@mahlawatep | 347 |

@shalinibhataniya1097 | 343 |

@murarry3625 | 333 |

@saiujwal13083 | 326 |

@rohitanand | 314 |

Complete Leaderboard |

You have got a maze, which is a n*n Grid. Every cell of the maze contains these numbers 1, 2 or 3.

If it contains 1 : means we can go Right from that cell only.

If it contains 2 : means we can go Down from that cell only.

If it contains 3 : means we can go Right and Down to both paths from that cell.

We cant go out of the maze at any time.

Initially, You are on the Top Left Corner of The maze(Entry). And, You need to go to the Bottom Right Corner of the Maze(Exit).

You need to find the total number of paths from Entry to Exit Point.

There may be many paths but you need to select that path which contains the maximum number of Adventure.

The Adventure on a path is calculated by taking the sum of all the cell values thatlies in the path.

**Example 1:**

**Input: **matrix = {{1,1,3,2,1},{3,2,2,1,2},
{1,3,3,1,3},{1,2,3,1,2},{1,1,1,3,1}}
**Output: **{4,18}
**Explanation: **There are total 4 Paths Available
out of which The Max Adventure is 18. Total
possible Adventures are 18,17,17,16. Of these
18 is the maximum.

**Your Task:**

You don't need to read or print anything. Your task is to complete the function **FindWays() **which takes matrix as input parameter and returns a list containg total number of ways to reach at (n, n) modulo 10^{9} + 7 and maximum number of Adventure.

**Expected Time Complexity: **O(n^{2})

**Expected Space Complexity: **O(n^{2})

**Constraints:**

1 <= n <= 100

Login to report an issue on this page.

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes
Adventure in a Maze

...