You know what a monotonic sequence is: each element is bigger than its predecessor (monotonically rising) or as its successor (monotonically falling).
Bitonic means you have two arms of the sequence, one monotonically rising, the other falling.
For example, 1,3,5,7,6,4,2
is bitonic (rising until 7, then falling until the end; 99,4,8,16
is as well (falling until 4, then rising until the end).
The task is to test, whether a sequence is bitonic (without being monotonic), with your code being as short as possible in your language of choice.
Input: A list of positive integer numbers without duplicates in a form that suits your language.
Output: Truthy/falsy
Test data:
True:
1,3,5,7,6,4,2
99,4,8,16
100000,10000,1000,100,10,1,11,111,1111,11111,111111
2,1,3,4,5,6
False:
1,2,3,4,5,6,7
7,6,5,4,3,2,1
1,4,7,6,2,3,5
99,88,66,77,55,44,33,22,11
1,9,2,8,3,7,4,6,5
99,4,8,16
bitonic? which for is less than both 99 and 8? \$\endgroup\$