Computer Science, asked by chetnasoni9095, 1 year ago

Mooshak the mouse has been placed in a maze.there is a huge chunk of cheese somewhere in the maze. the maze is represented as a two dimensional array of integers, where 0 represents walls.1 repersents paths where mooshak can move and 9 represents the huge chunk of cheese.mooshak starts in the top left corner at 0.write a method is path of class maze path to determine if mooshak can reach the huge chunk of cheese. the input to is path consists of a two dimensional array gnd for the maze matrix. the method should return 1 if there is a path from mooshak to the cheese.and 0 if not mooshak is not allowed to leave the maze or climb on walls.ex: 8 by 8(8*8) matrix maze where mooshak can get the cheese.1 0 1 1 1 0 0 11 0 0 0 1 1 1 11 0 0 0 0 0 0 01 0 1 0 9 0 1 11 1 1 0 1 0 0 11 0 1 0 1 1 0 11 0 0 0 0 1 0 11 1 1 1 1 1 1 1

Answers

Answered by aqsaahmed19945
0

Test Case 1


Input:{[1,1,1,][9,1,1],[0,1,0]}


Supposed return value :1


Explanation:


The piece of cheese is deposited at(1,0) on the grid Mooshak could move from (0,0) to (1,0) to reach that or can move from (0,0) to (0,1) to (1,1) to (1,0)


Test case 2:


Input: [[0,0,0],[9,1,1],[0,1,1]]


Supposed return value: 0


Explanation:

Zero would be the correct answer.

Mooshak can't move anyplace as there exists a divider appropriate on (0,0)



Answered by Sidyandex
0

Input: [[1, 1, 1,] [9,1,1], [0,1,0]]

Expected return value: 1

Explanation:

The piece of cheese is placed at(1,0) on the grid Mooshak can move from (0,0) to (1,0) to reach it or can move from (0,0) to (0,1) to (1,1) to (1,0)

Test case 2:

Input:

[[0,0,0], [9,1,1], [0,1,1]]

Expected return value: 0

Therefore 0 is the correct answer

Similar questions