Design Video Sharing Platform with Reusable Media Slots

Design a video sharing platform that manages reusable media slots. The platform starts empty and supports slots that can be reused after videos are removed. Each slot has a fixed capacity and holds a set of videos identified by videoId. Video titles are stored and retrievable globally by videoId. A videoId is globally unique while it exists.

The platform supports a deterministic functional dispatch solve(operations, args) that returns an array of strings array<string>, one encoded string per operation.

Return encoding (deterministic, no variant or Result type):

  • null is encoded as "null".
  • bool is encoded as "true" or "false".
  • integer is encoded as decimal string.
  • string (title from getVideo) is returned verbatim as the title string when present, otherwise "null" for missing.
  • list (listSlot sorted videoIds) is encoded by joining the sorted ids with comma ",". Empty list or missing slot is "" (empty string). Comma is safe because videoId never contains it in this problem.

Operations:

  • VideoPlatform with args [] creates a fresh platform. Returns "null".
  • createSlot with args [slotId, capacity] creates a reusable slot slotId with integer capacity > 0. Returns "true" if created, "false" if slotId already exists or capacity is not a positive integer.
  • uploadVideo with args [slotId, videoId, title] uploads video videoId with title into slotId. Returns "true" on success, "false" if slot does not exist, slot is full, or videoId already exists anywhere.
  • removeVideo with args [slotId, videoId] removes videoId from slotId and frees capacity for reuse. Returns "true" on success, "false" if slot or video not found in that slot.
  • listSlot with args [slotId] returns a comma-joined string of sorted videoIds in slotId, or "" if slot does not exist or is empty.
  • getVideo with args [videoId] returns the title string of videoId if it exists anywhere, otherwise "null".
  • moveVideo with args [srcSlotId, dstSlotId, videoId] moves videoId from srcSlotId to dstSlotId, freeing the source slot and occupying the destination slot. Returns "true" on success, "false" if either slot missing, video not in source, destination full, or destination already contains the video.

All slotId, videoId, title are strings. capacity is a number. Sorted order for listSlot is lexicographic ascending.

Examples
Input: [["VideoPlatform","createSlot","uploadVideo","uploadVideo","listSlot","getVideo"],[[],["slotA",2],["slotA","vid1","Intro"],["slotA","vid2","Demo"],["slotA"],["vid1"]]]
Output: ["null","true","true","true","vid1,vid2","Intro"]
Hints

Design Video Sharing Platform with Reusable Media Slots

Design a video sharing platform that manages reusable media slots. The platform starts empty and supports slots that can be reused after videos are removed. Each slot has a fixed capacity and holds a set of videos identified by `videoId`. Video titles are stored and retrievable globally by `videoId`. A videoId is globally unique while it exists.