[Python3] Solution and most importantly - Question Explained
Problem: Question is asking to return the stream of strings starting from the location idKey. \nIdea: Keep global variable self.loc; if the idKey is equal to se
Problem: Question is asking to return the stream of strings starting from the location **idKey**. \nIdea: Keep global variable ```self.loc```; if the idKey is equal to ```self.loc``` then return the array of strings. Otherwise return ```[]```\n\nI hope this helps someone!\nP.S.: It\'s better to skip this question! ;p\n\n```\nclass OrderedStream:\n    def __init__(self, n: int):\n        self.ls = ["" for i in range(n)]\n        self.loc = 0\n\n    def insert(self, idKey: int, value: str) -> List[str]:\n        self.ls[idKey - 1] = value\n        res = []\n        \n        if(self.loc == (idKey - 1)):\n            while(self.loc < len(self.ls) and self.ls[self.loc] != ""):\n                res.append(self.ls[self.loc])\n                self.loc += 1\n                \n        return res\n```
['Python3']