2020-9: Rise and Fall

Write code that, given an argument which is an integer scalar or vector, returns a 1 if the values of the argument conform to the following pattern (0 otherwise):

The elements increase or stay the same until the "apex" (highest value) is reached

After the apex, any remaining values decrease or remain the same

Examples

Implementation

You can also run the tests via ⌘/shift + enter