Given two sorted singly linked lists, return a sorted array of all elements that appear in both lists. Each element appears only once in the result.
Input: Heads of two sorted singly linked lists.
Output: Sorted array of common elements.
Input: [1,2,3,4,5], [3,4,5,6,7]
Output: [3,4,5]
Explanation: Common: 3,4,5.Input: [1,2,3], [4,5,6]
Output: []
Explanation: No common elements.Input: [1,2,3], [1,2,3]
Output: [1,2,3]
Explanation: All common.0<=nodes<=10^4-10^9<=Node.val<=10^9Both sorted ascending