• + 0 comments

    I could never think of such a short and neat approach. here is my bruteForce method:- static void reversePrint(SinglyLinkedListNode head) { ArrayList<Integer> pl=new ArrayList(); SinglyLinkedListNode temp=head; while(temp!=null){ pl.add(temp.data); temp=temp.next; } Collections.reverse(pl); for(int i:pl){ System.out.println(i); }