题目简介

LeetCode
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* struct ListNode *next;
* };
*/
typedef struct ListNode Node;
struct ListNode* middleNode(struct ListNode* head){
Node* fast = head;
Node* slow = head;
if(head->next == NULL)
{
return head;
}
while(fast != NULL)
{
if(fast->next == NULL)
{
break;
}
fast = fast->next->next;
slow = slow->next;
}
return slow;
}
博客主要介绍了LeetCode相关题目。围绕LeetCode展开,包含了题目的基本信息。
392

被折叠的 条评论
为什么被折叠?



