PROBLEM DESCRIPTION
Reverse the LinkedList.
SOLUTION
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
public static Node reverseLinkedList(Node head){
Node h1=head;
Node t=head;
Node h2=null;
while(h1 != null){
h1 = h1.next;
t.next = h2;
h2 = t;
t = h1;
}
return h2;
}