Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2e72b3d

Browse files
add 1114
1 parent84e00e2 commit2e72b3d

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

‎README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ _If you like this project, please leave me a star._ ★
189189
|1170|[Compare Strings by Frequency of the Smallest Character](https://leetcode.com/problems/compare-strings-by-frequency-of-the-smallest-character/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1170.java)||Easy||
190190
|1119|[Remove Vowels from a String](https://leetcode.com/problems/remove-vowels-from-a-string/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1119.java)|[:tv:](https://www.youtube.com/watch?v=6KCBrIWEauw)|Easy||
191191
|1118|[Number of Days in a Month](https://leetcode.com/problems/number-of-days-in-a-month/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1118.java)||Easy||
192+
|1114|[Print in Order](https://leetcode.com/problems/print-in-order/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1114.java)||Easy||
192193
|1108|[Defanging an IP Address](https://leetcode.com/problems/defanging-an-ip-address/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1108.java)|[:tv:](https://www.youtube.com/watch?v=FP0Na-pL0qk)|Easy||
193194
|1104|[Path In Zigzag Labelled Binary Tree](https://leetcode.com/problems/path-in-zigzag-labelled-binary-tree/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1104.java)||Medium|Math, Tree|
194195
|1103|[Distribute Candies to People](https://leetcode.com/problems/distribute-candies-to-people/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1103.java)||Easy|Math|
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
packagecom.fishercoder.solutions;
2+
3+
publicclass_1114 {
4+
publicstaticclassSolution1 {
5+
staticclassFoo {
6+
7+
privatestaticvolatilebooleanonePrinted;
8+
privatestaticvolatilebooleantwoPrinted;
9+
10+
publicFoo() {
11+
onePrinted =false;
12+
twoPrinted =false;
13+
}
14+
15+
publicsynchronizedvoidfirst(RunnableprintFirst)throwsInterruptedException {
16+
17+
// printFirst.run() outputs "first". Do not change or remove this line.
18+
printFirst.run();
19+
onePrinted =true;
20+
notifyAll();
21+
}
22+
23+
publicsynchronizedvoidsecond(RunnableprintSecond)throwsInterruptedException {
24+
while (!onePrinted) {
25+
wait();
26+
}
27+
28+
// printSecond.run() outputs "second". Do not change or remove this line.
29+
printSecond.run();
30+
twoPrinted =true;
31+
notifyAll();
32+
}
33+
34+
publicsynchronizedvoidthird(RunnableprintThird)throwsInterruptedException {
35+
while (!twoPrinted) {
36+
wait();
37+
}
38+
39+
// printThird.run() outputs "third". Do not change or remove this line.
40+
printThird.run();
41+
}
42+
}
43+
}
44+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp