Easy C++ solution | Time Complexity - O(n)
\n\nFrom the above example we can observe that :\n We need to put a breaker at index k.\n Take 2 variables low and high whose initial values are 1 and k+1 respe
<img src = "https://assets.leetcode.com/users/images/5edd4714-b747-47b3-9a37-897cc51d4663_1618233545.1771939.jpeg" width = "500" >\n\nFrom the above example we can observe that :\n* We need to put a breaker at index k.\n* Take 2 variables low and high whose initial values are 1 and k+1 respectively. \n* Till index k put low at even index and high at odd index. (increment low and decrement high values after every insertion)\n* After index k push value i + 1 at index i.\n\n**My Implementation :**\n\n```\nclass Solution {\npublic:\n    vector<int> constructArray(int n, int k) {\n        vector<int> ans;\n        int low = 1;\n        int high = k + 1;\n        for(int i = 0 ; i <= k ; i++){\n\t\t\t//at even index we assign lower value\n            if(i%2 == 0){\n                ans.push_back(low);\n                low++;\n            }\n\t\t\t//at odd index we put higher value\n            else{\n                ans.push_back(high);\n                high--;\n            }\n        }\n        for(int i = k+1 ; i <n ; i++)\n            ans.push_back(i+1);\n        \n        return ans;\n    }\n};\n```\nTime Complexity of this approach - O(N)\n
[]