Java solution with odd&even
for array res[], supposing the index(short for i) is from 0 to n-1:\n\nif i is odd, res[i] increases from 1;\nif i is even, res[i] decreases  from n;\nhigh is t
for array res[], supposing the index(short for i) is from 0 to n-1:\n\nif i is odd, res[i] increases from 1;\nif i is even, res[i] decreases  from n;\nhigh is the parameter **k**\nif low reaches high, the low stops growing,\n```\n\nclass Solution {\n    public int[] constructArray(int n, int k) {\n        int[] res=new int[n];\n        int low=1;\n        int high=k;\n        int poi=0;\n        int l=1;\n        int r=n;\n\n        for(int i=0;i<n;i++){\n               if(low%2==0){ //even\n                   res[poi++]=r--;\n            }else{\t//odd\n                   res[poi++]=l++;\n            }\n               if(low < high){    \n                   low++;\n            }\n        }\n  return res;\n    }\n}\n```\n
[]