All Posts

Leetcode 2424: Longest Uploaded Prefix

You are given a stream of n distinct videos, each represented by a unique number from 1 to n. You need to design a data structure that tracks the longest prefix of uploaded videos at any point in time. A prefix is considered uploaded if all videos from 1 to i (inclusive) have been uploaded to the server.