linkedList Middle

Run Settings
LanguagePython
Language Version
Run Command
def linkedListMiddle(self, head: Optional[ListNode]) -> int: #Initializing two linkedlist nodes slow & fast slow = head fast = head #Increment fast_ptr by 2 and slow_ptr by 1 positions until fast_ptr and fast_ptr.next is not NULL while(fast and fast.next): slow = slow.next fast = fast.next.next #Return the value at slow_ptr. return slow.data
Editor Settings
Theme
Key bindings
Full width
Lines