方法1:https://www.cnblogs.com/sgbe/p/10717861.html
方法2:用栈
public static Node1 printRevers(Node1 head) { if(head==null||head.next==null) return head; Stack<Character> st=new Stack(); Node1 dummy=head; while(dummy!=null) { st.push(dummy.val); dummy=dummy.next; } Node1 head1=new Node1('0'); Node1 h=head1; while(!st.isEmpty()) { Node1 temp=new Node1(st.pop()); h.next=temp; h=h.next; } return head1.next; }
转载于:https://www.cnblogs.com/sgbe/p/10718483.html
相关资源:JAVA上百实例源码以及开源项目