public ListNode reverseKGroup(ListNode head, int k) {
    	ListNode start = null, node = head, tail = null, pre = null, cur, preStart = null;
		int i;
		while(node != null){
			cur = node;
			for(i = 0; i < k && cur != null; i++) 
				if(cur != null) cur = cur.next;
			if(i < k){
				if(preStart != null)
					preStart.next = node;
                break;
			} else {
                i = 0;
                start = node;
                pre = null;
				while(node != null && i < k){
					tail = node.next;
					node.next = pre;
					pre = node;
					node = tail;
                    i++;
				}
				if(preStart == null)
					head = pre;
				else 
					preStart.next = pre;
                preStart = start;
			}
		}
		return head;
    }