https://leetcode-cn.com/problems/fan-zhuan-lian-biao-lcof/
[bug]
where is bug?
[wrong code]
/**
* Definition for singly-linked list.
* public class ListNode {
* int val;
* ListNode next;
* ListNode(int x) { val = x; }
* }
*/
class Solution {
public ListNode reverseList(ListNode head) {
return rev(head);
}
ListNode rev(ListNode head){
if(head==null || head.next==null){
return head;
}
ListNode sub = head.next;
ListNode ret = rev(sub);
sub.next = head;
return ret;
}
}```