Given a singly linked list and two 0-based positions i and j, swap the two nodes at those positions by changing the node links (not just the values). If i equals j or a position is out of range, the list is unchanged. The list is given as an array; return the resulting array. Input: '[list], i, j'.
Input: '[list], i, j'.
Output: Array — the list after swapping.
Input: [1,2,3,4,5], 0, 4
Output: [5,2,3,4,1]
Explanation: Head and tail swapped.Input: [1,2,3,4,5], 1, 3
Output: [1,4,3,2,5]
Explanation: Nodes 2 and 4 swapped.Input: [1], 0, 0
Output: [1]
Explanation: Same position, unchanged.0<=n<=10^40<=i,j<n