Files
Leetcode/876. Middle of the Linked List/Solution.cs
Electrominch cb2f99c3a8 Day4
2022-10-06 00:46:00 +03:00

16 lines
315 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;
}
}