Data Structures & AlgorithmsModerateICPC regional · Amazon SDE OA

What is the minimum absolute difference between two distinct elements of [12, 5, 9, 1, 15, 7]?

  1. A. 3
  2. B. 1
  3. C. 2
  4. D. 14

Correct answer: C. 2

After sorting, the closest values are adjacent: the gaps 5-7 and 7-9 are both 2, and no gap is smaller.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic