You are given an array of k arrays/linked-lists arrays, each array/linked-list is sorted in ascending or descending order. Merge all the arrays/linked-lists into one sorted array/linked-list and return it. Example 1: Input: arrays= [[1,4,5],[1,3,4],[2,6]]
Output: [1,1,2,3,4,4,5,6]
Explanation: The arrays/linked-lists are:
[
1->4->5,
1->3->4,
2->6
]
merging them into one sorted array/list:
1->1->2->3->4->4->5->6…