Valid Permutations for DI Sequence - Practice Coding | SlaveCode
0
0123456789
0
0123456789
:
0
0123456789
0
0123456789
903. Valid Permutations for DI Sequence
Hard
50 Points
String
Dynamic Programming
Prefix Sum
You are given a string s of length n where s[i] is either:
A permutation perm of n + 1 integers of all the integers in the range [0, n] is called a valid permutation if for all valid i:
Return the number of valid permutations perm. Since the answer may be large, return it modulo 109 + 7.
You are given a string s of length n where s[i] is either:
A permutation perm of n + 1 integers of all the integers in the range [0, n] is called a valid permutation if for all valid i:
Return the number of valid permutations perm. Since the answer may be large, return it modulo 109 + 7.