public ListNode reverseList (ListNode head) {
ListNode first = null;
ListNode current = head;
ListNode next = null;
while (current != null) {
next = current.next;
current.next = first;
first = current;
current = next;
}
return first;
}