Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution {
- public:
- ListNode* reverseList(ListNode* head) {
- ListNode* prev = NULL;
- ListNode* curr = head;
- ListNode* next;
- while(curr!=NULL){
- next = curr->next;
- curr->next = prev;
- prev= curr;
- curr = next;
- }
- return prev;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement