Count of all possible pairs of array elements with same parity
Given an array A[] of integers, the task is to find the total number of pairs such that each pair contains either both even or both odd elements. A valid pair (A[ i ], A[ j ]) can only be formed if i != j. Examples: Input: A[ ] = {1, 2, 3, 1, 3} Output: 6 Explanation: Possible odd pairs = (1, 3), (1, 1), (1, 3), (3, 1), (3, 3), (1, 3) = 6 Possible