C++ simple solution
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    vector<int> constructArray(int n, int k) {
        vector<int> result;
        bool dir=true;
        int left = 1, right = k+1;
        while(left<=right){
            if (dir)    result.push_back(left++);
            else        result.push_back(right--);
            dir = !dir;
        }
        for(int i=k+2;i<=n;i++)
            result.push_back(i);
        return result;

    }
};

```
['C++']