Car sorting problem

why are not taking square root to find the distance between two points?instead we do only x^2+y^2…is it because of comparing the elements and both will give same value?

hello @kani001

yeah final order will remain same in both the cases.