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):
nullis encoded as"null".boolis encoded as"true"or"false".integeris encoded as decimal string.string(title fromgetVideo) is returned verbatim as the title string when present, otherwise"null"for missing.list(listSlotsortedvideoIds) is encoded by joining the sorted ids with comma",". Empty list or missing slot is""(empty string). Comma is safe becausevideoIdnever contains it in this problem.
Operations:
VideoPlatformwith args[]creates a fresh platform. Returns"null".createSlotwith args[slotId, capacity]creates a reusable slotslotIdwith integercapacity > 0. Returns"true"if created,"false"ifslotIdalready exists orcapacityis not a positive integer.uploadVideowith args[slotId, videoId, title]uploads videovideoIdwithtitleintoslotId. Returns"true"on success,"false"if slot does not exist, slot is full, orvideoIdalready exists anywhere.removeVideowith args[slotId, videoId]removesvideoIdfromslotIdand frees capacity for reuse. Returns"true"on success,"false"if slot or video not found in that slot.listSlotwith args[slotId]returns a comma-joined string of sortedvideoIdsinslotId, or""if slot does not exist or is empty.getVideowith args[videoId]returns thetitlestring ofvideoIdif it exists anywhere, otherwise"null".moveVideowith args[srcSlotId, dstSlotId, videoId]movesvideoIdfromsrcSlotIdtodstSlotId, 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.
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.