We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent be96654 commit edfed07Copy full SHA for edfed07
Data-Structures/Linked-List/PrintReverse.js
@@ -0,0 +1,26 @@
1
+/**
2
+ * A LinkedList based solution for Printing a List in reverse
3
+ */
4
+
5
+function main () {
6
+ /*
7
+ Problem Statement:
8
+ Given a linked list, print the nodes in reverse order.
9
10
+ Link for the Problem: https://leetcode.com/problems/reverse-linked-list/
11
12
13
+ let head = ''
14
+ reverseList(head)
15
+}
16
17
+reverseList = function (headNode) {
18
+ let currentNode = headNode
19
+ if (currentNode != null) {
20
+ reverseList(currentNode.next)
21
+ console.log(currentNode)
22
+ }
23
24
25
+main()
26
0 commit comments