Data Structures & AlgorithmsModerateTCS NQT · CAT

Problem: The Euclidean distance squared between (1,2) and (4,6) is what integer?

  1. A. 5
  2. B. 7
  3. C. 49
  4. D. 25

Correct answer: D. 25

dx = 3 and dy = 4, so the squared distance is 9 + 16 = 25. Taking the square root gives 5, adding the differences gives 7, and squaring their sum gives 49.

More Coding Interview Problems questions

Exams that ask this topic