用递归的方法加反转链表的方法
/**
 * struct ListNode {
 *	int val;
 *	struct ListNode *next;
 * };
 */
class Solution {
public:
    /**
     * 
     * @param head ListNode类 
     * @param k int整型 
     * @return ListNode类
     */
    ListNode* reverseKGroup(ListNode* head, int k) {
    ListNode* tail=head;
    for(int i=0;i<k;i++)
    {
        if(tail==NULL)
        {
            return head;
        }
        tail=tail->next;
    }
    ListNode* cur=head;
    ListNode* pre=NULL;
    ListNode* temp=NULL;
    while(cur!=tail)
    {
        temp=cur->next;
        cur->next=pre;
        pre=cur;
        cur=temp;
    }
    head->next=reverseKGroup(tail,k);
    return pre;
    }
};