Easy Java Solution
\nclass Solution {\n    public int[] constructArray(int n, int k) {\n        int nums[] = new int[n];\n        nums[0] = 1;\n        boolean flip = false;\n    
```\nclass Solution {\n    public int[] constructArray(int n, int k) {\n        int nums[] = new int[n];\n        nums[0] = 1;\n        boolean flip = false;\n        int init = k + 1;\n        for(int i = 1 ; i < n ; i++) {\n            if(k == 0) nums[i] = 1 + init++;\n            else {\n                if(flip) {\n                    nums[i] = nums[i - 1] - k--;\n                    flip = false;\n                } else {\n                    nums[i] = nums[i - 1] + k--; \n                    flip = true;\n                }\n            }\n        }\n        return nums;\n    }\n}\n```
[]