10465

793

 

280

This also can be solved using bfs or dfs.

 

10313

 

260

This can be done using both stack or queue.

10724

 

247

 

10793

 

222

 

10075

Theory: Distance This uses the ‘haversine’ formula to calculate the great-circle distance between two points – that is, the shortest distance over the earth’s surface – giving an ‘as-the-crow-flies’ distance between the points (ignoring any hills they fly over, of course!). Haversine formula: a = sin²(Δφ/2) + cos φ1 * cos φ2 * sin²(Δλ/2) c = 2