Skip to content

Instantly share code, notes, and snippets.

View mbfisher's full-sized avatar

Mike Fisher mbfisher

  • GoCardless
  • London
View GitHub Profile
@mbfisher
mbfisher / 206-Reverse-Linked-List.py
Last active December 17, 2024 15:36
Leetcode 206 Reverse Linked List
# https://leetcode.com/problems/reverse-linked-list/description/
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def reverseList(self, head: Optional[ListNode]) -> Optional[ListNode]:
if head is None: