add new solutions
This commit is contained in:
parent
67cad91898
commit
81cc2d3ba6
19 changed files with 693 additions and 14 deletions
35
solutions/11/q1114/solution.go
Normal file
35
solutions/11/q1114/solution.go
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
package q1114
|
||||
|
||||
type Foo struct {
|
||||
one, two chan struct{}
|
||||
}
|
||||
|
||||
func NewFoo() *Foo {
|
||||
return &Foo{
|
||||
one: make(chan struct{}),
|
||||
two: make(chan struct{}),
|
||||
}
|
||||
}
|
||||
|
||||
func (f *Foo) First(printFirst func()) {
|
||||
// Do not change this line
|
||||
printFirst()
|
||||
|
||||
close(f.one)
|
||||
}
|
||||
|
||||
func (f *Foo) Second(printSecond func()) {
|
||||
<-f.one
|
||||
|
||||
/// Do not change this line
|
||||
printSecond()
|
||||
|
||||
close(f.two)
|
||||
}
|
||||
|
||||
func (f *Foo) Third(printThird func()) {
|
||||
<-f.two
|
||||
|
||||
// Do not change this line
|
||||
printThird()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue