Company: Infosys__..
Difficulty: medium
Count Increasing Triplets Problem Description Given an array of integers, return the number of strictly increasing subsequences of length 3. The result should be returned modulo 10 9 + 7. Note A subsequence is a sequence that can be derived from an array by deleting zero or more elements without changing the order of the remaining elements. Example 1 Input: n = 5, arr = [1, 2, 3, 4, 1] Output: 4 Explanation: The strictly increasing subsequences of length three are: [1, 2, 3] (from indices 0, 1, 2) [1, 2, 4] (from indices 0, 1, 3) [1, 3, 4] (from indices 0, 2, 3) [2, 3, 4] (from indices 1, 2, 3) There are 4 such subsequences. The answer is 4 modulo (10 9 + 7), which is 4.