Editorial for A Sequence Problem


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

Author: Ninjaclasher

We can show that the minimum difference between any 2 integers in the array will always be the difference between 2 adjacent integers in the sorted array.

Thus, we can sort the array, and then find the minimum difference between every adjacent pair of integers.

Time Complexity: \mathcal{O}(N\log N)


Comments

There are no comments at the moment.