Description
Solutions
Find K-Level Permutation

You have an array from 1 to N now you have to find a K-level permutation such that for N-K+1 segments or windows you get the difference between sum of maximum segment sum and minimum segment must be at most 1.

Example 1:

Input:  N = 7, K = 4
Output: [1, 7, 3, 5, 2, 6, 4]
Explanation:
N/A for now
Constraints:
    no constraint were given
Thumbnail 0
Testcase

Result
Case 1

input:

output: