Java || Explained the confusing description || Clean Solution
// Confusing descriptoin. Here is what I understood from the GIF\n// when insert() is called, return the longest list that starts at index of pointer. If there 
// Confusing descriptoin. Here is what I understood from the GIF\n// when insert() is called, return the longest list that starts at index of pointer. If there is not an elemnt at pointer(start), then return empty list\n\n// The POINTER is the next START window\n\n// TC : O(N) -> avg run time -> since we iterate the array once\n// SC : O(N) -> to store keys in worst case\n```\nclass OrderedStream {\n\n    private String[] arr;\n    private int currentPtr;\n    \n    public OrderedStream(int n) {\n        this.arr = new String[n];\n        this.currentPtr = 0;\n    }\n    \n    public List<String> insert(int idKey, String value) {\n        arr[idKey-1] = value;\n        \n        List<String> result = new ArrayList<>();\n        for(int i = currentPtr; i < arr.length; i++) { // run only starts from pointer, we do not need to start from 0\n            if(arr[i] == null) break; // if there is no element, this breaks the chain so come out of the for loop\n            result.add(arr[i]);\n            currentPtr++;\n        }\n        \n        return result;\n    }\n}\n```
[]