Search
⌘K

Leetcode 2424. Longest Uploaded Prefix

Given out-of-order uploads of videos numbered 1..n, design a data structure that tracks the largest k such that all videos 1..k have been uploaded. Support upload(video) and longest() efficiently (amortized O(1)) by marking arrivals and advancing a pointer while consecutive videos are present.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.