Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

you are given a matrix consisting of N rows and M columns. Each cell of the matrix contains one digit ( 0 , - 9

you are given a matrix consisting of N rows and M columns. Each cell of the matrix contains one digit(0,-9). Cells are adjacent if they share a common edge. it's possible to move from one cell to another directly only if they are adjacent.
find the largest group of cells such that:
1. you can get from any cell in the group to any other by moving only through cells belong to the group.
2. the difference between the largest and the smallest values of the cells in the group is at most 1.
write a function:
def solution(A)

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

Database Design And Implementation

Authors: Shouhong Wang, Hai Wang

1st Edition

1612330150, 978-1612330150

More Books

Students also viewed these Databases questions