You are given three arrays: `n`, `m`, and `totalCost`. The i-th element of `n` represents the length of an array, the i-th element of `m` represents the maximum possible value in the array (inclusive), and the i-th element of `totalCost` represents the desired cost of finding the maximum element in the array. The cost of finding the maximum element in an array is defined as the number of times the maximum value is updated when iterating through the array from left to right. For each i, you need to find the number of distinct arrays of length `n[i]` with values in the range `[1, m[i]]` such that the cost of finding the maximum element in the array is equal to `totalCost[i]`. Return an array containing the number of distinct arrays for each i.
{"n":[2,3,4],"m":[3,3,3],"totalCost":[1,2,2]}
3, 1, 6
{"n":[1,2],"m":[5,2],"totalCost":[1,2]}
5, 0
{"n":[3],"m":[2],"totalCost":[1]}
4
1 ≤ n.length ≤ 100
1 ≤ n[i] ≤ 10
1 ≤ m[i] ≤ 10
1 ≤ totalCost[i] ≤ n[i]