notmy_OrderedStream
 # Intuition  \n\n\n\n\n\n\n\n\n\n\n\n# Code\n\nclass OrderedStream {\n\tconstructor(n) {\n\t\tthis.pointer = 0;\n\t\tthis.list = [];\n\t}\n\n\tinsert(id, val) 
<!-- # Intuition -->\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n<!-- # Approach -->\n<!-- Describe your approach to solving the problem. -->\n\n<!-- # Complexity\n- Time complexity: -->\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n<!-- - Space complexity: -->\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass OrderedStream {\n\tconstructor(n) {\n\t\tthis.pointer = 0;\n\t\tthis.list = [];\n\t}\n\n\tinsert(id, val) {\n\t\tlet chunk = [];\n\t\tthis.list[id - 1] = val;\n\t\twhile (this.list[this.pointer]) {\n\t\t\tchunk.push(this.list[this.pointer]);\n\t\t\tthis.pointer++;\n\t\t}\n\t\treturn chunk;\n\t}\n}\n```
['JavaScript']