Problem · Array
Find K-Level Permutation
Learn this problemProblem statement
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.
Function
findKLevelPermutation(N: int, K: int) → int[]Examples
Example 1
N = 7K = 4return = [1, 7, 3, 5, 2, 6, 4]N/A for now
Constraints
no constraint were given