Files
Leetcode/876. Middle of the Linked List/Solution.cs
Electrominch e711e64e07 Clear
2022-10-07 00:48:48 +03:00

16 lines
316 B
C#

namespace _876._Middle_of_the_Linked_List;
public class Solution
{
public ListNode MiddleNode(ListNode? head)
{
ListNode result = head!;
while (head?.next != null)
{
head = head?.next?.next;
result = result!.next!;
}
return result;
}
}