Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
numpy solution in 3rd party category for Compass, Map and Spyglass by rodka81
import numpy as np
def navigation(seaside):
m = np.asmatrix(seaside)
start_x, start_y = np.where(m == 'Y')
distance = 0
for target in ['C', 'M', 'S']:
coord_x, coord_y = np.where(m == target)
distance += max(abs(coord_x[0] - start_x[0]),
abs(coord_y[0] - start_y[0]))
return np.asscalar(distance)
Sept. 5, 2018
Comments: