How would you merge two linked lists, both recursively and iteratively? Follow up: how would you merge n linked lists?
Treat each inner input list as the values of one sorted singly linked list. Implement both two-list approaches and use an iterative pairwise strategy for the n-list function. The function receives lists as list[list[int]] and returns the merged values as a sorted list[int].
Function signature: def merge_sorted_lists(lists):
def merge_sorted_lists(lists):