[back]

Split by Less-Than

Implement the function

val split_lt : int -> int list -> int list * int list

so that split_lt n l is a pair of lists such that the first list contains all elements of l less than n and the second list contains all elements of l greater than or equal to n. You must maintain the relative order of elements.

Examples

let _ = assert (split_lt 4 [1;3;5;2;4;6] = ([1;3;2], [5;4;6]))
let _ = assert (split_lt 0 [1;2;3] = ([], [1;2;3]))