//iterative
public ListNode ReverseList(ListNode head)
{
ListNode prev = null;
var current= head;
while(current!=null)
{
var next = current.next;
current.next=prev;
prev =current;
current=next;
}
return prev;
}
// recursive
public ListNode ReverseList(ListNode head)
{
if(head==null || head.next == null)
return head;
var t2 = ReverseList(head.next);
head.next.next = head;
head.next = null;
return t2;
}