Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

SOLVE THE FOLLOWING IN HASKELL WITHOUT USING PRELUDE FUNCTIONS OR IMPORTING ANY LIBRARIES. You may make as many helper functions as needed. A maze can

SOLVE THE FOLLOWING IN HASKELL WITHOUT USING PRELUDE FUNCTIONS OR IMPORTING ANY LIBRARIES. You may make as many helper functions as needed.

A maze can be represented as a grid containing paths or multiple paths from the source to the destination. However, for simplicity we will be assuming that we only have NxN grids which will be represented as a 2d List / Array. We will also assume that Soomro and Ahmed are starting from the cell at list[0][0] and the destination is list[n-1][n-1].

However, the cells will be labelled as E or O where E stands for empty and O stands for obstacles. Your job is to find all the possible paths that can lead them from the start to the end. Do this by adding P to the cells that can form a path from the source to the destination and return the grid.

Please note that we can only travel to the right or bottom. For example:

image text in transcribedimage text in transcribed

IT SHOULD PASS THE FOLLOWING TEST CASES:

image text in transcribed

With an input matrix of: There will be 2 corresponding paths as depicted in the following tables: Path a) Dath h) So the output will be: Note: No imports are allowed =

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions