We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
使用CountDownLatch实现,每一个线程的run方法运行完毕调用一次countDown方法,然后在主线程中执行await方法等待所有子线程的执行结束。
/** * struct ListNode { * int val; * struct ListNode *next; * }; */ class Solution { public: /** * 逆序 * @param head ListNode类 头结点 * @return ListNode类 */ ListNode* reverseList(ListNode* head) { // write code here ListNode tmp(0),*res = &tmp; for(ListNode* p = head->next;p;){ ListNode* tp = p->next; p->next = res->next; res->next = p; p = tp; } return res->next; } };
The text was updated successfully, but these errors were encountered:
No branches or pull requests
实现10个线程并发执行,完成后返回结果
求解
使用CountDownLatch实现,每一个线程的run方法运行完毕调用一次countDown方法,然后在主线程中执行await方法等待所有子线程的执行结束。
The text was updated successfully, but these errors were encountered: