1 基础功能

非递归的反转, 从尾巴 next curr->next; curr pre 关系的整合

2 代码

/*
struct ListNode {
	int val;
	struct ListNode *next;
	ListNode(int x) :
			val(x), next(NULL) {
	}
};*/
class Solution {
public:
    ListNode* ReverseList(ListNode* pHead) {
        ListNode *pre = nullptr, *curr=pHead,*next;
        while(curr){ //三元组的判定
            next = curr->next;
            curr->next = pre ;
            pre = curr;
            curr = next;
        }
        return pre;//not curr; //三元组的默契
        
    }
};