
Asked in Flipkart
Given an array, how do you find the number of pairs that sum to an even number?

Count the number of pairs in an array that sum to an even number.
Iterate through the array and check each pair of elements.
If the sum of the pair is divisible by 2, increment the count.
Return the coun...read more
((cntEven * (cntEven – 1)) / 2) + ((cntOdd * (cntOdd – 1)) / 2)
There can be a total of n(n-1) 2 numbers of total pairs from the given arrays number
It's can be done by the location and arithmetic operator with the help of if and else condition with a loop for the location of columns numbers in array and outer loop for changing the rows .

In order to get the pair sum as even, all the even elements will be paired with only even elements and all the odd elements will be paired with only odd elements and the count will be ((cntEven * (cnt...read more
Top Graduate Trainee Interview Questions Asked at Flipkart
Interview Questions Asked to Graduate Trainee at Other Companies
Top Skill-Based Questions for Flipkart Graduate Trainee


Reviews
Interviews
Salaries
Users

