Python Solution with time sleep (No locks) - Runtime: faster than 93%
Solution using a simple sleep method for 1 micro second. No mutex locks, semaphores, or thread handling events.\nNote: Though no locks were used, this implement
Solution using a simple sleep method for 1 micro second. **No mutex locks, semaphores, or thread handling events.**\n**Note:** *Though no locks were used, this implementation is somewhat similar to spin locks.*\n\n```\nclass ZeroEvenOdd:\n    def __init__(self, n):\n        self.n = n\n        self.count = 0\n        \n\t# printNumber(x) outputs "x", where x is an integer.\n    def zero(self, printNumber: \'Callable[[int], None]\') -> None:\n        i=0\n        while i<self.n:\n            if self.count%2 !=0: time.sleep(10 ** -6)\n            else: \n                printNumber(0)\n                self.count += 1\n                i+=1\n                \n        \n    def even(self, printNumber: \'Callable[[int], None]\') -> None:\n        i=0\n        while 2*i+2<=self.n:\n            if self.count % 4 != 3: time.sleep(10 ** -6)\n            else: \n                printNumber(2*i+2)\n                self.count += 1\n                i+=1\n        \n        \n    def odd(self, printNumber: \'Callable[[int], None]\') -> None:\n        i=0\n        while 2*i+1<=self.n:\n            if self.count % 4 != 1: time.sleep(10 ** -6)\n            else: \n                printNumber(2*i+1)\n                self.count += 1\n                i+=1\n```
[]