/*
public class ListNode {
int val;
ListNode next = null;
ListNode(int val) {
this.val = val;
}
}*/
public class Solution {
public ListNode ReverseList(ListNode head) {
if(head == null){
return head;
}
ListNode prev = null;
ListNode curr = head;
while(curr != null){
ListNode next = curr.next ;
curr.next = prev;
prev = curr;
curr = next;
}
return prev;
}
}