Java simple solution
public int[] constructArray(int n, int k) {\n        //number 1-n. if ascending order, always has diff = 1. \n        //reorder to be 1, k+1, 2, k, 3 ... so hav
    public int[] constructArray(int n, int k) {\n        //number 1-n. if ascending order, always has diff = 1. \n        //reorder to be 1, k+1, 2, k, 3 ... so have diff = k,k-1,k-2....1\n        int[] res = new int[n];\n        int inc = 1, dec = k+1;\n        for(int i=0;i<=k;i++){\n            if(i%2==0)\n                res[i] = inc++;\n            else\n                res[i] = dec--;\n        }\n       \n        for(int i=k+1;i<n;i++){\n            res[i] = i+1;\n        }\n        \n        return res;\n    }
[]