← 返回 microsoft 的题目列表Reverse Nodes in k-Group and Basic Mutex Programming
类型:online_judge
Given a linked list, reverse the nodes of a linked list k at a time. You need to write a function to achieve this task, and also create a basic mutex programming to protect shared resources.
Input: The first input is a list of node values followed by the value of k. The total number of nodes n is at least 1 and at most 5000.
Output: Return the modified linked list and the implementation of a basic mutex program.
Example
Input: [1, 2, 3, 4, 5], k = 2
Output: [2, 1, 4, 3, 5] and a sample mutex program.
Example
Input
1 2 3 4 5
2