File tree Expand file tree Collapse file tree 3 files changed +45
-5
lines changed Expand file tree Collapse file tree 3 files changed +45
-5
lines changed Original file line number Diff line number Diff line change @@ -2582,4 +2582,6 @@ https://leetcode.cn/problems/split-a-circular-linked-list/
2582
2582
2583
2583
https://leetcode.cn/problems/ipo
2584
2584
2585
+ https://leetcode.cn/problems/print-in-order/
2586
+
2585
2587
</details >
Original file line number Diff line number Diff line change @@ -10,10 +10,9 @@ using std::priority_queue;
10
10
using std::vector;
11
11
namespace leetcode_test ::ipo {
12
12
export class Solution {
13
- public:
14
- int findMaximizedCapital (int k, int w, vector<int >& profits,
15
- vector<int >& capital)
16
- {
13
+ public:
14
+ int findMaximizedCapital (int k, int w, vector<int > &profits,
15
+ vector<int > &capital) {
17
16
int n = profits.size ();
18
17
int curr = 0 ;
19
18
priority_queue<int , vector<int >, less<int >> pq;
@@ -39,4 +38,4 @@ public:
39
38
return w;
40
39
}
41
40
};
42
- }
41
+ } // namespace leetcode_test::ipo
Original file line number Diff line number Diff line change
1
+ module ;
2
+ #include < functional>
3
+ #include < future>
4
+ #include < thread>
5
+ using std::function;
6
+ using std::future;
7
+ export module leetcode_test.print_in_order.Foo;
8
+ namespace leetcode_test ::print_in_order {
9
+ export class Foo {
10
+ private:
11
+ std::promise<void > outpromise2;
12
+ std::promise<void > outpromise3;
13
+
14
+ public:
15
+ Foo () {}
16
+
17
+ void first (function<void ()> printFirst) {
18
+
19
+ // printFirst() outputs "first". Do not change or remove this line.
20
+ printFirst ();
21
+ outpromise2.set_value ();
22
+ }
23
+
24
+ void second (function<void ()> printSecond) {
25
+ future<void > fu = outpromise2.get_future ();
26
+ fu.get ();
27
+ // printSecond() outputs "second". Do not change or remove this line.
28
+ printSecond ();
29
+ outpromise3.set_value ();
30
+ }
31
+
32
+ void third (function<void ()> printThird) {
33
+ future<void > fu = outpromise3.get_future ();
34
+ fu.get ();
35
+ // printThird() outputs "third". Do not change or remove this line.
36
+ printThird ();
37
+ }
38
+ };
39
+ } // namespace leetcode_test::print_in_order
You can’t perform that action at this time.
0 commit comments