Question
C help only allowed to use stdio.hCreate a method named countInverses which takes an int array and the number of items in the array and
C help only allowed to use stdio.hCreate a method named countInverses which takes an int array and the number of items in the array and returns the number of positive value / additive inverse pairs in the array. For example: The following array {-2, -6, 4, 5, 2, 8, 9, -8, -4, 3} has the following positive value/additive inverse pairs: 2/-2, 4/-4, 8/-8 So the return value should be 3 since there are 3 pairs. Any duplicates should be counted only as many times as there are pairs. The following array {-1, 1, 1, 1, -1, 1, 3, -3, 3, 3, 3, 1, 1, 1, -1, -3} should return five since there are five pairs {-1, 1, 1, 1, -1, 1, 3, -3, 3, 3, 3, 1, 1, 1, -1, -3}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started