/**
* Definition for singly-linked list.
* public class ListNode {
* int val;
* ListNode next;
* ListNode(int x) { val = x; }
* }
*/
class Solution {
public ListNode reverseList(ListNode head) {
ListNode next = null;
ListNode pr = null ;
while(head!=null){
next = head.next;
head.next = pr;
pr = head;
head = next;
}
return pr;
}
}
06-24
156