Simple Iterative Python Solutiion, beats 99.66%

  • 0

    class Solution(object):
    def reverseList(self, head):
    :type head: ListNode
    :rtype: ListNode
    if head == None:
    current = head
    last = None
    while (current is not None):
    next = = last
    last = current
    current = next
    return last

Log in to reply

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