Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write in python 3 please Regions in Grid 1 & 2 Regions There are 2 regions in the second grid: { ( 0 , 0

Write in python3 please
Regions in Grid 1 & 2
Regions
There are 2 regions in the second grid: {(0,0),(0,1),(0,2),(1,0),(2,0)} and {(2,2)}.
Regions in grid 1 cover the first region of grid 2, but not the second region. There is 1 matching region.
Making a slight alteration to the above example:
111111
101100
100101
There are no matching regions. From the first graph, the 1 at position (1,2) is not matched in the second
grid's larger region. The second grid position (2,2) is not matched in grid 1.
Function Description
Complete the function countMatches in the editor below.
countMatches has the following parameter(s):
string grid1[n]: an array of bit strings representing the rows of image 1
string grid2[n]: an array of bit strings representing the rows of image 2
Returns:
int: number of matching regions.
Constraints
1n100
1 lengths of grid1[i] and grid2[i]100
grid cells contain only o or 1
Input Format For Custom Testing
Sample Case 0
Sample Input 0
)')'
Sample Output 0
1
Expianation 0
Regions in Grid 1 & 2
Regions
The first grid forms 2 regions. They are {(0,2),(1,1),(1,2)} and {(2,0)}
The second grid forms 2 regions. They are {(0,2),(1,1),(1,2),(2,2)} and {(2,0)}
So, only one region matches.
image text in transcribed

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

Pro SQL Server Wait Statistics

Authors: Enrico Van De Laar

1st Edition

1484211391, 9781484211397

More Books

Students also viewed these Databases questions

Question

What are Measures in OLAP Cubes?

Answered: 1 week ago

Question

How do OLAP Databases provide for Drilling Down into data?

Answered: 1 week ago

Question

How are OLAP Cubes different from Production Relational Databases?

Answered: 1 week ago