X interview question

implement a merge sort