C++ | No Logic | Just observed a pattern | Must see
Pattern :\n1) Start with "1"\n2) Firstly add "k" to the previous element of array and store it.\n3)  Secondly subtract "k-1" to the previous element of array an
**Pattern :**\n1) Start with "1"\n2) Firstly add "k" to the previous element of array and store it.\n3)  Secondly subtract "k-1" to the previous element of array and store it.\n4)  Do this until adding or subtracting number reaches 1.\n5)  store remaining number starting from arr[1]+1 in increasing order until its size becomes equal to n.\n\nex:-\n\n![image](https://assets.leetcode.com/users/images/aee08608-0a72-4d93-857f-2142ece5c9d2_1629904655.7689116.jpeg)\n\n\n```\nclass Solution {\npublic:\n    \n    void helper(vector<int> &ans, int k, bool takePositive){\n        if(k == 0)\n            return;\n        takePositive ? ans.push_back(ans[ans.size()-1] + k) : ans.push_back(ans[ans.size()-1] - k);\n        helper(ans, k-1, !takePositive);\n    }\n    \n    vector<int> constructArray(int n, int k) {\n        vector<int> ans;\n        ans.push_back(1);\n        helper(ans,k,true);\n        int c = n - ans.size();\n        int a = ans[1]+1;\n        while(c--)\n            ans.push_back(a++);\n        \n        return ans;\n    }\n};\n```\nI hope you will like this..... if yes then pls upvote...... explain karne me itni mehnat pehli baar ki he XD
['Recursion', 'C', 'C++']