标签:color pre blog nbsp col between ++ link head
class Solution { public ListNode reverseBetween(ListNode head, int m, int n) { ListNode pre=new ListNode(0); pre.next=head; ListNode p=pre; for(int i=0;i<m-1;i++) p=p.next; int s=n-m; ListNode q=p.next; while(s>0) { ListNode r=q.next; q.next=q.next.next; r.next=p.next; p.next=r; s--; } return pre.next; } }
标签:color pre blog nbsp col between ++ link head
原文地址:http://www.cnblogs.com/asuran/p/7606275.html