Skip to content

Instantly share code, notes, and snippets.

View kylemeow's full-sized avatar
📆
Fabricating the cloud

Kyle Dong kylemeow

📆
Fabricating the cloud
View GitHub Profile
@kylemeow
kylemeow / reverse_linked_list.cpp
Created December 9, 2015 05:32
Reverse Linked List
class Solution {
public:
ListNode* reverseList(ListNode* head) {
ListNode *newHead = NULL; // Head of the reversed list
ListNode *tmpNode = NULL; // Temporarily saves the value of previous newHead
while (head) {
tmpNode = newHead;