class ListReverse { ListReverse next; int data; int length; public ListReverse reverse(ListReverse x) { ListReverse result = null; ListReverse tmp = null; while ( x != null ) { tmp = x.next; x.next = result; result = x; x = tmp; } return result; } }
class ListReverse { ListReverse next; int data; int length; public ListReverse reverse(ListReverse x) { ListReverse result = null; ListReverse tmp = null; while ( x != null ) { tmp = x.next; x.next = result; result = x; x = tmp; } return result; } }