Question: Python def water_adjacent(map, r, c): Given a map and a location, are any of that spot's neighbors water? Water spots do not count themselves, only
Python
def water_adjacent(map, r, c): Given a map and a location, are any of that spot's neighbors water? Water spots do not count themselves, only their neighbors. If (r,c) isn't on the map, the answer is False.
Assume: map is a map as defined above, and r and c are int values.
water_adjacent(map1,1,1) True
water_adjacent(map1,2,2) False
water_adjacent([[1,1,1],[1,0,1],[1,1,1]],1,1) False
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
