Some solutions
An implementation of split-into-monotonics