C++ | 2-pointers
\nclass Solution {\npublic:\n    vector<int> constructArray(int n, int k) \n    {\n        vector<int>v;\n        int add=0;\n        for(int i=1;i<=n-k;i++)\n 
```\nclass Solution {\npublic:\n    vector<int> constructArray(int n, int k) \n    {\n        vector<int>v;\n        int add=0;\n        for(int i=1;i<=n-k;i++)\n        {\n            v.push_back(i);\n        }\n        int x=n-k+1,y=n;\n        for(int i=0;i<k;i+=2)\n        {\n            v.push_back(y--);\n            if(i+1<k)\n                v.push_back(x++);\n        }\n        return v;\n    }\n};\n```
[]