If the current time instance is even and sum is odd than it takes 2 more steps and few negations in previous elements to reach there .
Sum -= n NEW_LINE if ( Sum % 2 != 0 ) : NEW_LINE INDENT Sum -= 1 NEW_LINE ans . append ( sign * i ) NEW_LINE ans . append ( sign * - 1 * ( i + 1 ) ) NEW_LINE DEDENT ans [ int ( ( sum / 2 ) ) - 1 ] *= - 1 NEW_LINE return ans NEW_LINE