Rally Health interview question

coding weighted distances