do minimal distance search without the use of common array
codeeval still gives a single 0.0