<p>You are given a stream of <code>n</code> videos, each represented by a <strong>distinct</strong> number from <code>1</code> to <code>n</code> that you need to "upload" to a server. You need to implement a data structure that calculates the length of the <strong>longest uploaded prefix</strong> at various points in the upload process.</p>
<p>We consider <code>i</code> to be an uploaded prefix if all videos in the range <code>1</code> to <code>i</code> (<strong>inclusive</strong>) have been uploaded to the server. The longest uploaded prefix is the <strong>maximum </strong>value of <code>i</code> that satisfies this definition.<br/>
<br/>
Implement the <code>LUPrefix </code>class:</p>
<ul>
<li><code>LUPrefix(int n)</code> Initializes the object for a stream of <code>n</code> videos.</li>
<li><code>void upload(int video)</code> Uploads <code>video</code> to the server.</li>
<li><code>int longest()</code> Returns the length of the <strong>longest uploaded prefix</strong> defined above.</li>