Skip to main content

Accenture

Accenture OA-19 2024

Problem Description

You are given an integer array A of length N. Your task is to find and return an integer value representing the count of unique pairs whose product is a multiple of 3.

Note: A Unique pair means that the elements must be the same regardless of their order. For instance, (1, 3) and (3, 1) are considered as the same pair.

Input Format:

  • input1: An integer value N, representing the size of the array
  • input2: An integer array A

Output Format:

Return an integer value representing the count of unique pairs whose product is a multiple of 3.

Constraints:

  • 2≤N≤10^5: The size of the array.
  • 1≤A[i]≤10^6 The values in the array.

Example

Sample Input:

A = [1, 2, 3, 4, 5, 6]
N = 6

Sample Output:

4

Explanation:
The unique pairs whose product is a multiple of 3 are: (1, 3), (1, 6), (2, 3), (2, 6).