Domanda di colloquio di Own Company

Find the max squared distance between two points given 4 points as integers

Risposta di colloquio

Anonimo

20 feb 2020

int maxDistance = (int)(Math.pow(A - B, 2) + Math.pow(C - D, 2)); maxDistance = Math.max(maxDistance, (int)(Math.pow(A - C, 2) + Math.pow(B - D, 2))); return Math.max(maxDistance, (int)(Math.pow(A - D, 2) + Math.pow(B - C, 2)));