Golang solution with explanation of problem
Intuition\nMy intuition here was to look at tons of solutions on youtube & leetcode until I could understand the problem because the description made no mention
# Intuition\nMy intuition here was to look at tons of solutions on youtube & leetcode until I could understand the problem because the description made no mention of a pointer.\n\n# Approach\nWhat the description to the problem completely leaves out, is that our class needs two things:\n- A container for the values\n  - This list is stored as a slice in Go, which is 0-indexed\n  - The id arguments will be given 1-indexed\n- A pointer to an index in our list, which is initialized at the beginning and stays there until the first element in our list gets inserted.\n\nUntil the first element [id 1 in argument, index 0 in this.list] in our list is inserted, we will always return an empty slice.\n\nWhen the first element is inserted, we move the pointer until it arrives at an index in this.slice which has no value.\n\nTake the given example where we initalize an empty slice of size 5:\n\nvalue: ["","","","",""]\nindex: [ 0, 1, 2, 3, 4]\nptr: index 0\n\n1. Insert [3, "ccccc"]\n\nvalue: ["","","ccccc","",""]\nindex: [ 0, 1, 2, 3,      4]\nptr begin: index 0\nptr end: index 0\n\nThe pointer remains set to index 0 in this.list so we return [""].\n\n2. Insert [1, "aaaaa"]\n\nvalue: ["aaaaa","","ccccc","",""]\nindex: [ 0, 1, 2, 3, 4]\nptr begin: index 0\nptr end: index 1\n\nThe pointer was pointing to index 0, but it\'s no longer empty, so we move it until it points to an empty index.\nptr begin: index 0\nptr end: index 1\n\nWe return this.list["aaaaa"] because that is the longest list of non-empty values beginning from where the ptr started.\n\n3. Insert [2, "bbbbb"]\nvalue: ["aaaaa","bbbbb","ccccc","",""]\nindex: [ 0, 1, 2, 3, 4]\nptr begin: index 1\nptr end: index 3\n\nThe ptr started at index 1, which is no longer empty, so we move it until it points to an empty index. That moves the ptr to index 3.\n\nWe return this.list["bbbbb","ccccc"] because that is the longest list of non-empty values beginning from where the ptr started.\n\n4. Insert [5, "eeeee"]\nvalue: ["aaaaa","bbbbb","ccccc","","eeeee"]\nindex: [ 0, 1, 2, 3, 4]\nptr begin: index 3\nptr end: index 3\n\nWe inserted into the last index, but the index we are pointing at is still empty so we return this.list[""]\n\n5. Insert [4, "ddddd"]\nvalue: ["aaaaa","bbbbb","ccccc","ddddd","eeeee"]\nindex: [ 0, 1, 2, 3, 4]\nptr begin: index 3\nptr end: index 5 (Up to but not including this element, the end of list)\n\nWe inserted where the pointer was pointing, so we move the pointer until it points to an empty index or the end of the list. We arrive at the end of the list.\n\nWe return ["ddddd","eeeee"]\n\nI hope this explanation was helpful, please upvote if you liked it.\n\n\n# Complexity\n- Time complexity:\n$$O(n)$$\n\n- Space complexity:\n$$O(n)$$\n\n# Code\n```\ntype OrderedStream struct {\n    ptr int\n    list []string\n}\n\nfunc Constructor(n int) OrderedStream {\n    return OrderedStream{\n        list : make([]string, n),\n        // The pointer starts at the first index [0] in this.list.\n        ptr  : 0,\n    }\n}\n\nfunc (this *OrderedStream) Insert(id int, value string) []string {\n    // Always insert. It is a 1-indexed id in a 0-indexed slice, so subtract 1\n    this.list[id-1] = value\n\n    // Only when a value at the first index [0] is added do we move this.ptr.\n    // Until then, we return empty strings.\n    if this.list[this.ptr] == "" {\n        return []string{}\n    }\n\n    // At this point, we have a value at this.ptr.\n    // We increment this.ptr until we find an empty value or we reach\n    // the end of this.list.\n    var end = this.ptr\n    for this.ptr < len(this.list) && this.list[this.ptr] != "" {\n        this.ptr++\n        end++\n    }\n    // Return the sub-array of values.\n    return this.list[id-1:end]\n}\n```
['Go']