The absolute value of the difference between adjacent numbers in the array is 1, and find the first occurrence of the specified number

as found the first 9 in 1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 5, 6, 7, 8, 9, 10, 9

a[0]=1;

Find a[0+(9-a[0])]=4, which means that there must be no 9 in front. From this 4, if there is a 9 behind it, only 5+4 is needed, that is, find a[8+4]=7; then Find a[12+(9-7)]=9

Each time a[i+abs(?-a[i])]==?

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324795453&siteId=291194637