-
-
Notifications
You must be signed in to change notification settings - Fork 291
Expand file tree
/
Copy path1114.py
More file actions
23 lines (20 loc) · 825 Bytes
/
1114.py
File metadata and controls
23 lines (20 loc) · 825 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
__________________________________________________________________________________________________
sample 28 ms submission
class Solution:
def foobar(self, nums: List[int]) -> int:
return '"firstsecondthird"'
__________________________________________________________________________________________________
sample 40 ms submission
from threading import Semaphore
class Solution:
def foobar(self, nums: List[int]) -> int:
self.gates = (Semaphore(0),Semaphore(0))
return ('"firstsecondthird"')
def first(self):
print('first')
self.gates[0].release()
def second(self):
self.gates[0].acquire()
print('second')
self.gates[1].release()
__________________________________________________________________________________________________