Reverse Linked List in Python

  • 0

    class Solution(object):
    def reverseList(self, head):
    :type head: ListNode
    :rtype: ListNode
    return self._reverse(head)

    def _reverse(self, node):
        if node is None or is None:
            return node
        head = self._reverse( = node = None
        return head

Log in to reply

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