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