Simple two pointer solution || c++ || beats 100%
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    vector<int> constructArray(int n, int k) {\n        int i = 1;\n        int j = n;\n        vector<int> ans;\n        while(i <= j){\n            if(k > 1){\n                if( k % 2 == 0){\n                    ans.push_back(j);\n                    j--;\n                }else{\n                    ans.push_back(i);\n                    i++;\n                }\n                k--;\n            }else{\n                ans.push_back(i);\n                i++;\n            }\n        }\n        return ans;\n    }\n};
['Array', 'Two Pointers', 'C++']