[Python 3] Two pointers, O(n), 40ms
Increasing (e.g. 1, 2, 3, 4, 5) or decreasing (e.g. 5, 4, 3, 2, 1) list gives minimum 1 distinct absolute difference.\n- Jumping min-max list 1, n, 2, n-1, 3, n
- Increasing (e.g. `1, 2, 3, 4, 5`) or decreasing (e.g. `5, 4, 3, 2, 1`) list gives minimum `1` distinct absolute difference.\n- Jumping min-max list `1, n, 2, n-1, 3, n-2, ...` (e.g. `1, 5, 2, 4, 3`) or max-min list `n, 1, n-1, 2, n-2, 3, ...` (e.g. `5, 1, 4, 2, 3`) gives maximum `n-1` distinct absolute differences.\n- To get exactly `k` (e.g. `3`) differences we need to concatenate two algorithms. We can use `k` elements from the second algorithm and `n-k` elements from the first one (e.g. `(1, 5, 2), (3, 4)`) or `n-k` elements from the first algorithm and `k` elements from the second one (e.g. `(1, 2), (5, 3, 4)`).\n- Time complexity is `O(n)`. Additional space complexity is `O(1)`.\n```\nclass Solution:\n    def constructArray(self, n: int, k: int) -> List[int]:\n        i, j = 1, n; ret = [i] \n        while i < j:\n            if (k > 1) ^ (ret[-1] == i):\n                i += 1; ret.append(i)\n            else:\n                ret.append(j); j -= 1\n            k -= 1\n                \n        return ret\n```
['Two Pointers', 'Python']