diff --git a/Data-Structures/Linked-List/PrintReverse.js b/Data-Structures/Linked-List/PrintReverse.js new file mode 100644 index 0000000000..9d9df1b90d --- /dev/null +++ b/Data-Structures/Linked-List/PrintReverse.js @@ -0,0 +1,16 @@ +/** + * A LinkedList based solution for Printing a List in reverse + * + * Problem Statement: + * Given a linked list, print the nodes in reverse order + * Link for the Problem: https://leetcode.com/problems/reverse-linked-list/ + */ + +const reverseList = (currentNode) => { + if (currentNode != null) { + reverseList(currentNode.next) + console.log(currentNode) + } +} + +export { reverseList }