Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write A C++ programme with this following instruction Question 3: Tom and Jerry [8] Category: Medium Izaan, a little boy, loves to watch Tom &

image text in transcribed

Write A C++ programme with this following instruction

Question 3: Tom and Jerry [8] Category: Medium Izaan, a little boy, loves to watch Tom & Jerry. He loves this cartoon so much that he dreams of this cartoon character while sleeping. One day, he saw in his dream that Tom caught Jerry and imprison Jerry in a cage that looks like a two-dimensional matrix as shown in the following image which has only one way to escape and Jerry wanted to escape from that matrix. Izaan wanted to help Jerry in his dream, but he could not. So that Izaan was crying, suddenly Orni, the aunt of Izaan, came and asked him about the matter. Izaan clearly remembered the pattern of the cage. Now, Izaan wants Orni to show the path for Jerry to escape from the cage so that he can help Jerry next time or report that it's not possible to escape from the cage. Can you help Orni to solve this problem? ESCAPE You are given a nxm dimensional matrix, where n represents the number of row and m represents the number of columns. The matrix contains 4 integers from 0 to 3. 0: Escape 1: The current position of Jerry 2: Danger Zone for Jerry and Jerry won't go those indices 3: Safe Zone You have to print the path by which Jerry can escape from the cage or report that it's impossible. If it's impossible to escape from the case print -1. Jerry can move in four directions only. Left, Right, Up and Down. 5

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Information Modeling And Relational Databases

Authors: Terry Halpin, Tony Morgan

2nd Edition

0123735688, 978-0123735683

More Books

Students also viewed these Databases questions