MCPcopy Create free account
hub / github.com/Hsinha11/Leetcode-solutions / reverseLL

Method reverseLL

25. Reverse Nodes in k-Group/Solution.cpp:17–26  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15class Solution {
16public:
17 ListNode* reverseLL(ListNode* head)
18 {
19 if(head == NULL || head->next == NULL)
20 return head;
21 ListNode *new_head = reverseLL(head->next);
22 ListNode *front = head->next;
23 front->next = head;
24 head->next = NULL;
25 return new_head;
26 }
27 ListNode* findKthNode(ListNode* temp, int k)
28 {
29 for(int i = 1; i<k;i++)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected