Solution with Runtime: 97.1% JAVA
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 
# 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    String[] arr;\n    int ptr = 1;\n\n    public OrderedStream(int n) {\n        arr = new String[n + 1];\n    }\n\n    public List<String> insert(int idKey, String value) {\n        ArrayList<String> k = new ArrayList<>();\n        arr[idKey] = value;\n\n        if (ptr != idKey) return k;\n        \n        for (int i = ptr; i < arr.length && arr[i] != null; i++) {\n            k.add(arr[i]);\n            ptr++;\n        }\n\n        return k;\n    }\n}\n\n/**\n * Your OrderedStream object will be instantiated and called as such:\n * OrderedStream obj = new OrderedStream(n);\n * List<String> param_1 = obj.insert(idKey,value);\n */\n```
['Java']