Question: def is_peak(map, r, c): Given a map and a location, is it land and are all neighboring land spots lower than it? If the spot
def is_peak(map, r, c): Given a map and a location, is it land and are all neighboring land spots lower than it? If the spot isn't on the map, it is not a peak. It's possible to have peaks on the border. Assume: map is a map as defined above, and r and c are int values. is_peak(map2,1,3) True is_peak(map2,2,3) False is_peak(map5,3,3) True
def on_map(map, r, c): if r >= 0 and c >= 0 and r

mapl[ [e,e,0,0,0], map2 [ [4,1,0, ,0,0,2], map3 [ [5,4,5], map4 [ [5,0,1,0,6], map6 [ [4,6,7,6,5,4], [e,0,0,9,0], 4,0,0,0,2] [0,0,0,0,0], [8,0,3,0,7] 1 [6,5,6,5,5,5], [6,5,3,4,5,6], [0,0,0,e,0,0], [8,8,8,8,8,6], [8,7,8,9,8,7], 8,8,8,8,8,6] [ 0, 3, 5,12, 4, 1, , ], map7 = [ [0,0,0,0,0,0], map8 [ [e,0,0,0,0,5,0,e], [e,5,0,e,5,0], [e,e,0,0,0,0], [e,5,9,e,5,0], [0,0,7,7,0,0], [0,6,0,0,6,0] [0,0,0,0,4,0,0,0], e,0,0,e,0,0,8,8], [e,0,0,0,0,8,8,8]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
