This question evaluates understanding of permutations, array range reasoning, index mapping, and efficient algorithm design for detecting contiguous subarrays that exactly contain the prefix set {1..k}.
You are given a permutation of length containing each integer from to exactly once.
For each where , determine whether there exists a contiguous subarray of whose elements are exactly the set (in any order).
'1'
if
is balanced, otherwise
'0'
.
'0'
and
'1'