implemented upto split-into-monotonics. my implementation is more generic than the one in the excercise, because it can split the given sequence into both increasingand decreasing sequences.