Hi ;) can you please help me with this problem , I think its an easy dp but i cant solve :
a permutation with numbers [1, n] is called extremal if for each i ( 1 < i < n ) one of this conditions be true :
1 : pi < pi - 1 and pi < pi + 1
2 : pi > pi - 1 and pi > pi + 1
count the number of extremal permutations with size n ( n ≤ 104 ) modulo m