Got this question in OA for Amazon ML summer school, India. 2024
Sam's Dilemma
Sam is solving an interesting math problem. He is working with integer arrays and trying to perform some operations on them. He gets stuck at some point and asks you for help.
You are given 3 integer arrays named A, B and C. Using them you have to create triplets of all possible combinations by taking one integer from every array. Perform a XOR operation on every triplet and return the number of triplets that have an even number of set bits.
Note: Set bits are the number of 1s in the binary representation of a decimal number.
Input Specification:
input1 : An integer array A.
input2 : An integer value representing the length of array A.
input3 : An integer array B.
input4 : An integer value representing the length of array B.
input5 : An integer array C.
input6 : An integer value representing the length of array C.
Output Specification:
Return an integer value representing the number of triplets that have an even number of set bits.