Problem Description Loading... Problem Analysis Record the index of each number into $a[t]=i$ then simply accumulate $abs(a[i+1]-a[i])$