Using merge sorting method

Time complexity is O(knlog(n))  space complexity is O(log(k))