Company: Ibm_4_Jan
Difficulty: medium
Count Increasing Pairs Problem Description Given an array of n integers, return the number of strictly increasing subsequences of length 2. 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. Examples Example 1: Input: n = 3, arr = [1, 2, 1] Output: 1 Explanation: There is only one increasing subsequence of length 2: {1, 2}. This is formed by the elements at index 0 and index 1. Pair (arr[0], arr[1]) = (1, 2) -> Is Strictly Increasing? Yes Pair (arr[0], arr[2]) = (1, 1) -> Is Strictly Increasing? No Pair (arr[1], arr[2]) = (2, 1) -> Is Strictly Increasing? No Example 2: Input: n = 4, arr = [3, 1, 4, 2] Output: 3 Explanation: The valid increasing subsequences of length 2 are: {3, 4}, {1, 4}, and {1, 2}. Constraints 1 ≤ n ≤ 5000 Code Snippet (Java) import java.io.*; import java.util.*; class Result { /* * Complete the 'countIncreasingPairs' function below. * * The function is exp