- محدودیت زمان: ۱ ثانیه
- محدودیت حافظه: ۲۵۶ مگابایت
Sara wants to hold a birthday party for her niece. In this ceremony, the guests form a circle around the niece and cheer her up. But the problem is that the heights of the guests present at the birthday party is very different. Therefore, if these guests are randomly placed in the circle, due to the difference in height, they may not be able to hold each other’s hands and form the ring. The desired arrangement is a circular arrangement of guests in which the maximum height difference between consecutive individuals is minimum (there may be more than one desired arrangement). For example, if the heights of guests are , one desired arrangement could be as follows, where the maximum height difference between consecutive individuals is .
By receiving the heights of guests, calculate the maximum height difference between consecutive individuals in a desired arrangement.
ورودی
The first line of the input contains an integer , which is the the number of guests. The next line contains a sequence of integers, where represents the height of the guests.
خروجی
In the only line of output, print the maximum difference in height between two consecutive individuals in a desired circular arrangement.
ورودی نمونه 1
خروجی نمونه 1
ورودی نمونه 2
خروجی نمونه 2
ارسال پاسخ برای این سؤال