Easy JS Solution: Queue
Explanation:\nData structure : Queue. \n\n\nvar LUPrefix = function(n) {\n    let q = new Array(n).fill(0);\n    this.q = q;\n    this.f = 0; //"f" is front of 
**Explanation:**\nData structure : Queue. \n\n```\nvar LUPrefix = function(n) {\n    let q = new Array(n).fill(0);\n    this.q = q;\n    this.f = 0; //"f" is front of queue\n};\n\n//O(1)\nLUPrefix.prototype.upload = function(video) {\n    this.q[video - 1] = 1;\n};\n\n//O(n)\nLUPrefix.prototype.longest = function() {\n    while(this.q[this.f] && this.f < this.q.length) {\n        this.f += 1;\n    }\n    return this.f;\n};\n ```
['Queue', 'JavaScript']