Write a function isPeak that takes an IntArray? and returns true
if and only if it is a peak. An array is a peak if it consists of a single run
of increasing numbers joined with a single run of decreasing numbers.
For example {1, 2, 1} is a peak, since it has the increasing run {1, 2}
joined with the decreasing run {2, 1}.
The runs need not be strictly increasing or strictly decreasing. For example,
{1, 1, 2, 2, 1, 1} is a peak, since it consists of {1, 1, 2, 2} joined with
{2, 2, 1, 1}. However, there must be at least one increase and one decrease
in the array for it to qualify. {1, 1, 2}, {2, 1, 1}, and
{1, 1, 1} should all fail under this condition.
Notice that these conditions require arrays of at least length 3. If your array
is shorter than this or null, return false.
Stuck? You may find these lessons helpful: