An interesting (to me) sequence

Правка en3, от aurora_, 2019-06-27 22:16:36

Suppose, you have N consecutive numbers. You need to arrange them in such a way that, after arranging, subtraction between any two adjacent number will not be same. Numbers at index 1 and N will be considered adjacent. And also, you must put number 1 at index 1. For example, when N=4, [ 1 ] , [ 3 ]<---(+2), [ 4 ]<---(+1), [ 2 ]<---(-2), [ 1 ]<---(-1)

this is a valid arrangement.

Is there any approach to find a O(N * log N) solution? Thanks in advance.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский aurora_ 2019-06-27 22:16:36 20
en2 Английский aurora_ 2019-06-27 22:15:12 27
en1 Английский aurora_ 2019-06-27 22:13:11 462 Initial revision (published)