class Solution { public ListNode reverseList(ListNode head) { if(headnull||head.nextnull){ return head; } ListNode newhead=reverseList(head.next); head.next.next=head; head.next=null; return newhead; } }