public ListNode reverseKGroup(ListNode head, int k) {// 1 边界条件ListNode node = head;int count = 0;while (count < k) {if (node == null) {return head;}count++;node = node.next;}// 2 下潜ListNode pre = reverseKGroup(node, k);// 3 解决子问题while (0 < count--) {ListNode next = head.next;head.next = pre;pre = head;head = next;}return pre;}
