Design a comprehensive video sharing platform similar to YouTube or TikTok that supports core functionalities like uploading, deleting, watching, and rating videos.
Each video is represented as a string of digits, where the i-th digit represents the content at minute i. For example, video "12345" has content '1' at minute 0, '2' at minute 1, and so on.
Key Features:
- Smart ID Management: Videos get the smallest available ID starting from 0. Deleted video IDs can be reused.
- Video Streaming: Users can watch specific time ranges of videos
- Engagement Tracking: Track views, likes, and dislikes for each video
- Content Management: Upload and remove videos dynamically
Implement the VideoSharingPlatform class with methods for upload, remove, watch, like, dislike, and analytics retrieval. The platform should efficiently handle video ID recycling and maintain accurate engagement metrics.
Input & Output
Visualization
Time & Space Complexity
Heap operations for ID management, direct hash access for video operations
Space for heap, hash maps, and video content storage
Constraints
- 1 โค video.length โค 105
- The sum of video.length over all calls to upload does not exceed 105
- video consists of digits
- 0 โค startMinute < endMinute < 105
- 0 โค videoId < 105
- At most 104 calls will be made to all functions combined
- All video content must consist only of digit characters