Python Solution O(n)
Python Solution\nTime Complexity : o(n)\n\nclass Solution:\n    def constructArray(self, n: int, k: int) -> List[int]:\n        arr = [0] *n\n        arr[0] = 1
Python Solution\nTime Complexity : o(n)\n```\nclass Solution:\n    def constructArray(self, n: int, k: int) -> List[int]:\n        arr = [0] *n\n        arr[0] = 1\n        c = k \n        for i in range(1,k+1):\n            if i % 2 ==1:\n                arr[i] = arr[i-1] +k\n                k -= 1\n            else:\n                arr[i] = arr[i-1] -k\n                k -= 1\n        for i in range(c+1, n):\n            arr[i] = i+1\n        return arr\n```
[]