https://www.codechef.com/CLWC2021/problems/CLWI21F

i am trying this problem since contest ended and not getting could you guys can explain so that

we beginner can also understand

bro you need to know what is a **subarray** and what is a **permutation** ? .

**subarray** :- It is continous part of array . you can read more about it here :- Subarray/Substring vs Subsequence and Programs to Generate them - GeeksforGeeks

**permutation** :- An array of size is a permutation of **n** when it contains element from **1 to n**

I can explain you we need to check for permutations for **1<= i <= n**

then we need to check for each **i** there is a subarray which is a permutation too .

let us see test case 1:-

```
8
2 1 3 5 4 6 8 7
```

for i = 1 there is a **subarray** which is permuation of **1** —>`[ 1 ]`

for i=2 there is a **subarray** which is permuation of **2** ---->` [2,1]`

for i=3 there is a **subarray** which is permuation of **3** ---->` [ 2 ,1 ,3]`

for i=4 there is **no subarray**which is permuation of **4**

similar is case when i=5.

but for i=6 we have a **subarray** which is permuation of **6** —> `[ 2 , 1, 3, 5,4 ,6] `

- for which we have a subarray we add
**1**in string else we add**0**

thanks

i understand the problem but not getting idea to solve this i was asking for that

I thought you didn’t got question my bad .