You are given three integers n, l, and r.
An array arr of length n is considered a ZigZag array if:
l arr[i] r for every index
Adjacent elements strictly alternate between increasing and decreasing throughout the array. That is, one of the following conditions must hold:
arr[0] arr[1] arr[2] arr[3]
arr[0] arr[1] arr[2] arr[3]
Return the total number of valid ZigZag arrays. Since the answer may be large, return it modulo
Constraints:
n
l r
You are given three integers n, l, and r.
An array arr of length n is considered a ZigZag array if:
l arr[i] r for every index
Adjacent elements strictly alternate between increasing and decreasing throughout the array. That is, one of the following conditions must hold:
arr[0] arr[1] arr[2] arr[3]
arr[0] arr[1] arr[2] arr[3]
Return the total number of valid ZigZag arrays. Since the answer may be large, return it modulo
Constraints:
n
l r