private ListNode getMid(ListNode head) {

    ListNode faster = head;
    ListNode prev = head;

    while (head != null && faster != null && faster.next != null) {
      prev = head;
      head = head.next;
      faster = faster.next.next;
    }
    prev.next = null;

    return head;
  }