Question: For this assignment write the following function that takes in a pointer reference to an array of any arbitrary elevation profile and its array size,
For this assignment write the following function that takes in a pointer reference to an array of any arbitrary elevation profile and its array size, and outputs the max cross sectional area of the biggest pond based on this profile:
int getMaxPond(int* arr, int size)
Examples:
input: [22,31,1,23]
output: 66
input: [1]
output: 0
input: [1,3,5]
output: 3
input: [3,2,1]
output: 2 (see below graphical illustration - either you take the orange box or red you end up with a max area of 2)
input: [1,1,1,1,1,1,1,1,1]
output: 8
input: [1,99,1]
output: 2

Array 3, 2,1] Array 3, 2,1]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
