Clear
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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!;
|
||||
|
||||
Reference in New Issue
Block a user