In a dynamic software development team, the mentor enjoys giving algorithmic challenges to junior developers. One day, the mentor presents the following task:
The junior developer is given a list of n tasks. The complexity of the ith task is represented by a positive integer all. The mentor tasks the junior developer to select a sequence of n tasks whose complexities are represented by an array b(l) such that:
The task is to calculate the number of different valid arrays b(l) that meet these conditions. Since the answer may be very large, print it modulo 998244353.
n = 2
a = [2, 3]
In this case, possible arrays are [1, 2], [1, 3], [2, 1], and [2, 3].
Hence, the answer is 4.
Complete the function getTotalArrays in the editor.
getTotalArrays has the following parameter(s): int a[n]: the elements of array a.
int: the number of different valid arrays b(l), modulo 998244353.
Hard