diff --git a/Leetcode-Easy/Reverse_Linked_List.c b/Leetcode-Easy/Reverse_Linked_List.c new file mode 100644 index 0000000..426f464 --- /dev/null +++ b/Leetcode-Easy/Reverse_Linked_List.c @@ -0,0 +1,23 @@ +/** + * Definition for singly-linked list. + * struct ListNode { + * int val; + * struct ListNode *next; + * }; + */ + + +struct ListNode* reverseList(struct ListNode* head) +{ + struct ListNode *q=NULL,*r=NULL; + while(head) + { + r=q; + q=head; + head=head->next; + q->next=r; + } + head=q; + return head; + +}