Amazon Interview Question

Robot Circle Graph related question to find minimum distances