Given an array, how do you get the count of pairs that sum to even

AnswerBot
1y
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...
see more
Anonymous
1y

((cntEven * (cntEven – 1)) / 2) + ((cntOdd * (cntOdd – 1)) / 2)

Anonymous
1y

There can be a total of n(n-1) 2 numbers of total pairs from the given arrays number

Add answer anonymously...
Flipkart Graduate Trainee Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2023 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter