Decent results.
Intuition\n Describe your first thoughts on how to solve this problem. \nWhen idKey - 1 != ptr we simply return empty array of strings.\nWhen idKey - 1 == ptr w
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nWhen `idKey - 1 != ptr` we simply return empty array of strings.\nWhen `idKey - 1 == ptr` we iterate through array until we find an empty slot. Collect all strings in range of `ptr - idKey - 1`.\n\n# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(n) ???\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nBecause we need to keep OrderedStream so we could collect arrays of strings ??\n# Code\n```\ntypedef struct {\n    char **list;\n    int ptr;\n    int size;\n} OrderedStream;\n\n\nOrderedStream* orderedStreamCreate(int n) {\n    OrderedStream *stream = malloc(sizeof(OrderedStream));\n    stream->list = calloc(n, sizeof(char *));\n    for (int i = 0; i < n; i++) { stream->list[i] = ""; }\n    stream->ptr = 0;\n    stream->size = n;\n\n    return stream; \n}\n\nchar ** orderedStreamInsert(OrderedStream* obj, int idKey, char * value, int* retSize) {\n    int size = 0;\n    int idx = idKey - 1;\n\n    obj->list[idx] = value;\n\n    for (; (obj->ptr < obj->size) && strcmp(obj->list[obj->ptr], "") != 0; obj->ptr++) {\n        size++;\n    }\n\n    if (size == 0){\n        char str[] = {};\n        return str;\n    }\n\n    char **result = malloc(size * sizeof(char *));\n    for (int i = 0; idx < obj->ptr; i++) { result[i] = obj->list[idx++]; }\n\n    *retSize = size;\n    return result;\n}\n\nvoid orderedStreamFree(OrderedStream* obj) {\n    if (obj == 0) { return; }\n\n    free(obj->list);\n    free(obj);\n}\n\n/**\n * Your OrderedStream struct will be instantiated and called as such:\n * OrderedStream* obj = orderedStreamCreate(n);\n * char ** param_1 = orderedStreamInsert(obj, idKey, value, retSize);\n \n * orderedStreamFree(obj);\n*/\n```
['C']