Question: Using CPP answer the following in detail. ty in advance Write a function with the following signature: int autological(int arr[], int size) The function should

Using CPP answer the following in detail. ty in advance

Using CPP answer the following in detail. ty in advance Write a

Write a function with the following signature: int autological(int arr[], int size) The function should take in an array of integers, and its size and it should return the value of the largest autological element in the array. If there are no autological elements, return -1. An autological element of a collection is an element that appears as many times as its value. Example Input: [7,9,1, 3] Output: 1 Explanation: The only autological element in the array is 1, because it appears 1 time, hence it is also the largest Input: [2,7,9,1, 2, 3] Output: 2 Explanation: There are two autological members in this array, 1 and 2, because 1 appears once and two appears twice. The largest of them is 2. Input: [7,9,5, 2, 3] Output: -1 Explanation: There are no autological emelents in this array because none of them appear the same number of times as their own value

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!