Given a permutation p of the integers from 1 to n, for each value k from 1 to n, determine whether there exists a contiguous subarray of p with exactly k elements that contains precisely the integers 1, 2, ..., k in any order.
Ask AI Assistant

Ask AI Assistant
Ask me anything about this coding question!
Test Cases
Input
Output
Expected