Simple O(N) Python Solution
Recognized this pattern after observing multiple test cases.\n1. Have a visited array initialised to FALSE. Start with \'1\' then find x = last_value + k, then 
Recognized this pattern after observing multiple test cases.\n1. Have a visited array initialised to FALSE. Start with \'1\' then find x = last_value + k, then append x in result array.\n2. Decrement k.\n3. Then in next iteration, find x = last_value - k. then append x to result array.\n4. After this, append all the values that are not visited.\n```\ndef constructArray(self, n: int, k: int) -> List[int]:\n        result = [1]\n        visited = [False for i in range(n+1)]\n        visited[1] = True\n        flag = True\n        while k-1:\n            a = abs(result[-1] + k)\n            b = abs(result[-1] - k)\n            if flag:\n                result.append(a)\n                visited[a] = True\n                flag = not flag\n            else:\n                result.append(b)\n                visited[b] = True\n                flag = not flag\n            k -= 1\n        for i in range(1, len(visited)):\n            if not visited[i]:\n                result.append(i)\n        return result\n```
[]