LC: 1265. Print Immutable Linked List in Reverse
Input: head = [1,2,3,4]
Output: [4,3,2,1]Input: head = [0,-4,-1,3,-5]
Output: [-5,3,-1,-4,0]Input: head = [-2,0,6,4,4,-6]
Output: [-6,4,4,6,0,-2]Last updated
Input: head = [1,2,3,4]
Output: [4,3,2,1]Input: head = [0,-4,-1,3,-5]
Output: [-5,3,-1,-4,0]Input: head = [-2,0,6,4,4,-6]
Output: [-6,4,4,6,0,-2]Last updated
/**
* // This is the ImmutableListNode's API interface.
* // You should not implement it, or speculate about its implementation.
* interface ImmutableListNode {
* public void printValue(); // print the value of this node.
* public ImmutableListNode getNext(); // return the next node.
* };
*/
class Solution {
public void printLinkedListInReverse(ImmutableListNode head) {
}
}