Easiest 5-line Java Solution!!!


  • 0
    G
        public ListNode reverseList(ListNode head) {
            if(head == null || head.next == null) return head;
            ListNode result = reverseList(head.next);
            head.next.next = head;
            head.next = null;
            return result;
        }

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.