4ms beats 100% Java solution without using Concurrent package
upon construction, build work, a string and a pointer which shall be worked on.\n2. worker threads will \n     - quit if there is no work done\n     - if there 
1. upon construction, build work, a string and a pointer which shall be worked on.\n2. worker threads will \n     - quit if there is no work done\n     - if there is work, is it my duty?\n         - if it\'s my duty, I process it, and increament the pointer\n         - call notifyall so all other threads be triggered sequentially\n```\n    private final String str;\n    private volatile int index;\n\n    public ZeroEvenOdd(int n) {\n      StringBuilder sb = new StringBuilder();\n      for (int i = 1; i <= n; i++) {\n        sb.append(\'0\');\n        sb.append(i);\n      }\n      this.str = sb.toString();\n      this.index = 0;\n    }\n\n    // printNumber.accept(x) outputs "x", where x is an integer.\n    public void zero(IntConsumer printNumber) throws InterruptedException {\n      synchronized (this) {\n        while (true) {\n          if (index == str.length())\n            break;\n          if (\'0\' == str.charAt(index)) {\n            printNumber.accept(0);\n            index++;\n            notifyAll();\n          } else {\n            wait(); // this is not my turn\n          }\n        }\n      }\n    }\n\n    public void even(IntConsumer printNumber) throws InterruptedException {\n      synchronized (this) {\n        while (true) {\n          if (index == str.length())\n            break;\n          int number = str.charAt(index) - \'0\';\n          if (number != 0 && (number & 1) == 0) { // even number\n            printNumber.accept(number);\n            index++;\n            notifyAll();\n          } else {\n            wait(); // this is not my turn\n          }\n        }\n      }\n    }\n\n    public void odd(IntConsumer printNumber) throws InterruptedException {\n      synchronized (this) {\n        while (true) {\n          if (index == str.length())\n            break;\n          int number = str.charAt(index) - \'0\';\n          if ((number & 1) == 1) { // odd number\n            printNumber.accept(number);\n            index++;\n            notifyAll();\n          } else {\n            wait(); // this is not my turn\n          }\n        }\n      }\n    }\n```\n\nOne  issue on description is that `where the length of the series must be 2n.`.  This is incorrect.  What AC expects is a preceeding 0 on all numbers.  So when `n=11`, there are expecting `010203040506070809010011`.
['Java']