Question: Write a Boolean method that accepts an integer array as input This method should return true if the array is a mountain, and false if

Write a Boolean method that accepts an integer array as input This method should return true if the array is a mountain, and false if it is not. An array is considered a mountain if it has only one peak. For example:

[1, 2, 3, 4, 7, 9, 5, 3, 1] is a mountain. The values increase to a maximum (9), and then decrease until the end of the array.

[1, 2, 3, 4, 3, 2, 5, 7, 8, 9, 4, 2] is NOT a mountain, because the values increase to 4, then decrease to 2, then increase back to 9, and finally decrease until the end. This array has two peaks.

JAVA

INEED A FULL SOLUTION

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!