Easy Java Solution Beats 99% onine submissions
Code\n\nclass OrderedStream {\n    private String[] data;\n    private int ptr;\n\n    public OrderedStream(int n) {\n        data = new String[n + 1];\n       
# Code\n```\nclass OrderedStream {\n    private String[] data;\n    private int ptr;\n\n    public OrderedStream(int n) {\n        data = new String[n + 1];\n        ptr = 1;\n    }\n\n    public String[] insert(int idKey, String value) {\n        data[idKey] = value;\n        List<String> res = new ArrayList<>();\n        for (int i = ptr; i < data.length; i++) {\n            if (data[i] != null) {\n                res.add(data[i]);\n            } else {\n                ptr = i;\n                break;\n            }\n        }\n        return res.toArray(new String[0]);\n    }\n}\n```
['Array', 'Hash Table', 'Design', 'Data Stream', 'Java']