This commit is contained in:
Electrominch
2022-10-07 00:48:48 +03:00
parent 0b88604037
commit e711e64e07
18 changed files with 45 additions and 45 deletions

View File

@@ -4,8 +4,8 @@
{
static void Main(string[] args)
{
var l1 = ListNode.Create(new int[] { 1,2,3,4,5});
var l2 = ListNode.Create(new int[] { 1,2,3,4,5,6});
var l1 = ListNode.Create(new int[] { 1, 2, 3, 4, 5 });
var l2 = ListNode.Create(new int[] { 1, 2, 3, 4, 5, 6 });
Console.WriteLine(new Solution().MiddleNode(l1).val);
Console.WriteLine(new Solution().MiddleNode(l2).val);
}

View File

@@ -5,7 +5,7 @@ public class Solution
public ListNode MiddleNode(ListNode? head)
{
ListNode result = head!;
while(head?.next != null)
while (head?.next != null)
{
head = head?.next?.next;
result = result!.next!;