Skip to content

Commit 3b7acac

Browse files
committed
Python solution for reverse linked list
1 parent 8e77eb3 commit 3b7acac

File tree

3 files changed

+2
-50
lines changed

3 files changed

+2
-50
lines changed

DSA 450 GFG/next_greater_element.py

Lines changed: 0 additions & 48 deletions
This file was deleted.

DSA 450 GFG/reverse_linked_list_iterative.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#https://leetcode.com/problems/reverse-linked-list/
22

33
# Iterative method
4-
54
#Approach :
65

76
# Store the head in a temp variable called current .

DSA 450 GFG/reverse_linked_list_rec.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# Approach :
2-
32
# Divide the linked list to two halved
43
# First half is head and the remaining as rest
54
# The head points to the rest in a normal linked list
@@ -12,6 +11,8 @@
1211
# def __init__(self, val=0, next=None):
1312
# self.val = val
1413
# self.next = next
14+
15+
1516
class Solution:
1617
def reverseList(self, head):
1718
if head is None or head.next is None:

0 commit comments

Comments
 (0)