← Return

Print in ReverseEasy

This challenge is part of a tutorial track by MyCodeSchool and is accompanied by a video lesson.

Given a pointer to the head of a singly-linked list, print each \(data\) value from the reversed list. If the given list is empty, do not print anything.

Example

\(head*\) refers to the linked list with \(data\) values \(1 \to 2 \to 3 \to NULL\). Print the following:

3
2
1