标签:
1 /* 2 public class ListNode { 3 int val; 4 ListNode next = null; 5 6 ListNode(int val) { 7 this.val = val; 8 } 9 }*/ 10 public class Solution { 11 public ListNode ReverseList(ListNode head) { 12 if(head ==null){ 13 return null ; 14 } 15 ListNode l2 = null ; 16 ListNode l2head = l2 ; 17 while(head!=null){ 18 ListNode temp = head.next ; 19 head.next = l2 ; 20 l2 = head ; 21 head = temp ; 22 } 23 24 return l2 ; 25 } 26 }
标签:
原文地址:http://www.cnblogs.com/huntertoung/p/4765176.html