why can't my python code work?


  • -1
    Z

    '''class Solution(object):
    def reverseList(self, head):
    """
    :type head: ListNode
    :rtype: ListNode
    """
    prev=None
    while head:
    curr=head
    curr.next=prev
    head=head.next
    prev=curr
    return prev'''

    it is essentially the same as the standard answer


  • 0
    M

    Because it lacks indentation?


Log in to reply
 

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