<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Vishal Vaibhav on Medium]]></title>
        <description><![CDATA[Stories by Vishal Vaibhav on Medium]]></description>
        <link>https://medium.com/@vishal.turnal?source=rss-89efe3dfee11------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*pQT91bi1eKv31MSK.</url>
            <title>Stories by Vishal Vaibhav on Medium</title>
            <link>https://medium.com/@vishal.turnal?source=rss-89efe3dfee11------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 02:17:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vishal.turnal/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[LeetCode 1500: Design a file sharing system]]></title>
            <link>https://medium.com/@vishal.turnal/leetcode-1500-design-a-file-sharing-system-cf49a29e9d58?source=rss-89efe3dfee11------2</link>
            <guid isPermaLink="false">https://medium.com/p/cf49a29e9d58</guid>
            <category><![CDATA[data-structure-algorithm]]></category>
            <dc:creator><![CDATA[Vishal Vaibhav]]></dc:creator>
            <pubDate>Thu, 29 Aug 2024 01:01:49 GMT</pubDate>
            <atom:updated>2024-08-29T01:01:49.660Z</atom:updated>
            <content:encoded><![CDATA[<p>Please click on this <a href="https://leetcode.com/problems/design-a-file-sharing-system/description/">link</a> to view the complete problem description.</p><p>We are building a file-sharing system to manage the distribution of a large file divided into m small chunks, each identified by an ID from 1 to m.</p><p>The system works as follows:</p><ul><li><strong>User Management:</strong> When a user joins, they are assigned a unique ID (the smallest positive integer not currently used). If a user leaves, their ID is made available for reuse.</li><li><strong>Chunk Requests:</strong> Users can request a specific chunk of the file. The system will provide a list of IDs of all users who currently own that chunk. If the list is not empty, the user requesting the chunk receives it successfully.</li></ul><p><strong>Class Implementation:</strong></p><ol><li><strong>FileSharing(int m):</strong> Initializes the system with a file containing m chunks.</li><li><strong>int join(int[] ownedChunks):</strong> Registers a new user with their owned chunks and assigns them a unique ID.</li><li><strong>void leave(int userID):</strong> Removes a user from the system, making their ID reusable.</li><li><strong>int[] request(int userID, int chunkID):</strong> Returns a sorted list of user IDs that currently own the requested chunk.</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4a673d71f9a6c2766010d9773e46478b/href">https://medium.com/media/4a673d71f9a6c2766010d9773e46478b/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cf49a29e9d58" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>