leetle
36. Single Linked List Middle
83%
Write a function solve that returns the middle node of a singly linked list. If two middles, return the second one.
Example:Input: [1,2,3,4,5]Output: 3
Make sure you return your solution, don't print!
Python3
# Singly Linked List Definition
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
def solve(head):
pass
Submit
GridFailuresHints
Test Cases
Attempts