예제 #1
0
  public static void main(String[] args) {
    ReverseLinkedList instance = new ReverseLinkedList();
    LinkedLists.ListNode node = instance.reverseList(instance.head);
    LinkedLists.ListNode temp = node;

    while (temp != null) {
      System.out.println(temp.val);
      temp = temp.next;
    }
  }
예제 #2
0
  public static void main(String[] args) {
    // TODO Auto-generated method stub

    ReverseLinkedList list = new ReverseLinkedList();
    ListNode head = new ListNode(1);
    ListNode p1 = new ListNode(2);
    ListNode p2 = new ListNode(3);
    head.next = p1;
    p1.next = p2;
    list.reverseList(head);
  }