Available question text
Count the number of permutations of 0..n that satisfy the adjacent inequality pattern given by s (s[i] = 'I' means perm[i] < perm[i+1], 'D' means perm[i] > perm[i+1]) and return the result modulo 10^9+7. The core challenge is to efficiently enumerate/count these permutations (n ≤ 200) using dynamic programming / combinatorial range-sum transitions that exploit runs of consecutive I's or D's.
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 903. Valid Permutations for DI Sequence
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source