This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from unittest import TestCase, main | |
def valid_parentheses(string): | |
x = 0 | |
for char in string: | |
if char == '(': | |
x += 1 | |
elif char == ')': | |
if x == 0: | |
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type goPool struct { | |
hold sync.WaitGroup | |
work chan func() | |
ready chan bool | |
} | |
func newGoPool(jobs uint) *goPool { | |
pool := &goPool{} | |
pool.ready = make(chan bool, jobs) | |
pool.work = make(chan func()) |