You are viewing a single comment's thread. Return to all comments →
if(head==null) System.out.println(""); else{ List list=new ArrayList(); while(head!=null){ list.add(head.data); head=head.next; } Collections.reverse(list); for(Integer d:list){ System.out.println(d); } }
Seems like cookies are disabled on this browser, please enable them to open this website
I agree to HackerRank's Terms of Service and Privacy Policy.
Print in Reverse
You are viewing a single comment's thread. Return to all comments →