Company: Cohesity
Difficulty: medium
Fun Arrays Alice and Bob are inventing what they call *fun arrays*. After some arguing they settle on four rules. An array `arr` of length `n`, with elements `arr[1], arr[2], ..., arr[n]`, is **fun** when all four hold: 1. `arr[i] > arr[j]` for every pair of positions `1 <= i < j <= n` - the array is strictly decreasing. 2. `n >= 2` - a one-element array is no fun. 3. `arr[i] > 0` for every `1 <= i <= n` - every element is positive. 4. `arr[1] + arr[2] + ... + arr[n] = funnum` - the elements add up to the given fun number. Given the fun number, count how many fun arrays exist. Input Format A single line containing one integer `funnum`. Output Format Print a single integer: the number of fun arrays whose elements sum to `funnum`. Constraints `1 <= funnum <= 200` The answer is largest at `funnum = 200`, where it is `487067745`. That is below `2^31 - 1 = 2147483647`, so a signed 32-bit integer is enough for the answer and for every intermediate count. A 64-bi