mirror of
				https://git.wolves.top/wolves/leetcode.git
				synced 2025-11-04 09:16:32 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			34 lines
		
	
	
		
			583 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
		
			583 B
		
	
	
	
		
			C++
		
	
	
	
	
	
//
 | 
						|
// Created by 李洋 on 2023/11/7.
 | 
						|
//
 | 
						|
 | 
						|
#ifndef LEECODE_C_Q876_H
 | 
						|
#define LEECODE_C_Q876_H
 | 
						|
 | 
						|
#include <vector>
 | 
						|
#include <stack>
 | 
						|
 | 
						|
using namespace std;
 | 
						|
 | 
						|
struct ListNode {
 | 
						|
    int val;
 | 
						|
    ListNode *next;
 | 
						|
 | 
						|
    ListNode() : val(0), next(nullptr) {}
 | 
						|
 | 
						|
    ListNode(int x) : val(x), next(nullptr) {}
 | 
						|
 | 
						|
    ListNode(int x, ListNode *next) : val(x), next(next) {}
 | 
						|
};
 | 
						|
 | 
						|
ListNode *middleNode(ListNode *head) {
 | 
						|
    ListNode *slow = head, *fast = head;
 | 
						|
    while (fast && fast->next) {
 | 
						|
        slow = slow->next;
 | 
						|
        fast = fast->next->next;
 | 
						|
    }
 | 
						|
    return slow;
 | 
						|
}
 | 
						|
 | 
						|
#endif //LEECODE_C_Q876_H
 |