Print reverse LinkedList

Input format : Linked List elements (separated by space and terminated by -1)

Output format : Linked List elements in reverse order (separated by space)

Sample Input 1 :
1 2 3 4 5 -1
Sample Output 1 :
5 4 3 2 1
Sample Input 2 :
1 2 3 -1
Sample Output 2 :
3 2 1

Login to submit your solution

Fb dab53a1a64929320dc7425896aa73fd9e5512b6ab52e414ff5f3ebb5cecc73eb

Share Problem